Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
293,800
String () { return mySdkRootName; }
getSdkRootName
293,801
String () { return myOldSdkRootName; }
getOldSdkRootName
293,802
String () { return myModulePathsName; }
getModulePathsName
293,803
Project () { return (Project)getSource(); }
getProject
293,804
ProjectRootManager (@NotNull Project project) { return project.getService(ProjectRootManager.class); }
getInstance
293,805
void () { }
dispose
293,806
void (@NotNull Element element) { throw new UnsupportedOperationException("Implement PersistentStateComponent"); }
readExternal
293,807
void (@NotNull Element element) { throw new UnsupportedOperationException("Implement PersistentStateComponent"); }
writeExternal
293,808
Collection<VirtualFile> () { return mySourceRoots; }
getSourceRoots
293,809
Collection<VirtualFile> () { return myBinaryRoots; }
getBinaryRoots
293,810
Set<VirtualFile> () { return myExcludedRoots; }
getExcludedRoots
293,811
Condition<VirtualFile> () { return (Condition<VirtualFile>)myExcludeCondition; }
getExcludeFileCondition
293,812
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ImmutableSyntheticLibrary library = (ImmutableSyntheticLibrary)o; if (!Objects.equals(getComparisonId(), library.getComparisonId())) return false; if (!mySourceRoots.equals(library.getSourceRoots())) return false; if (!myBinaryRoots.equals(library.getBinaryRoots())) return false; if (!myExcludedRoots.equals(library.getExcludedRoots())) return false; return Objects.equals(myExcludeCondition, library.getExcludeFileCondition()); }
equals
293,813
int () { return hashCode; }
hashCode
293,814
boolean () { return true; }
skipWriteIfEmpty
293,815
String () { return myName; }
name
293,816
boolean () { return false; }
skipWriteIfEmpty
293,817
List<PersistentOrderRootType> () { List<PersistentOrderRootType> allTypes = new ArrayList<>(); Collections.addAll(allTypes, getAllPersistentTypes()); allTypes.sort((o1, o2) -> o1.name().compareToIgnoreCase(o2.name())); return allTypes; }
getSortedRootTypes
293,818
int () { return super.hashCode(); }
hashCode
293,819
boolean (Object obj) { return super.equals(obj); }
equals
293,820
String () { return "Root " + name(); }
toString
293,821
Collection<SyntheticLibrary> (@NotNull Project project) { return Collections.emptyList(); }
getAdditionalProjectLibraries
293,822
Collection<VirtualFile> (@NotNull Project project) { return Collections.emptyList(); }
getRootsToWatch
293,823
AddDependencyType (@NotNull OrderEntry orderEntry, @NotNull OrderEnumeratorSettings settings) { return AddDependencyType.DEFAULT; }
shouldAddDependency
293,824
boolean () { return false; }
shouldAddRuntimeDependenciesToTestCompilationClasspath
293,825
boolean () { return true; }
shouldIncludeTestsFromDependentModulesToTestClasspath
293,826
boolean () { return true; }
shouldProcessDependenciesRecursively
293,827
boolean () { return true; }
areResourceFilesFromSourceRootsCopiedToOutput
293,828
boolean (@NotNull LibraryOrSdkOrderEntry forOrderEntry, @NotNull OrderRootType type, @NotNull Collection<String> urls) { return addCustomRootsForLibrary(forOrderEntry, type, urls); }
addCustomRootsForLibraryOrSdk
293,829
boolean (@NotNull OrderEntry forOrderEntry, @NotNull OrderRootType type, @NotNull Collection<String> urls) { return false; }
addCustomRootsForLibrary
293,830
boolean (@NotNull OrderRootType type, @NotNull ModuleRootModel rootModel, @NotNull Collection<String> result, boolean includeProduction, boolean includeTests) { return false; }
addCustomModuleRoots
293,831
ModuleRootManager (@NotNull Module module) { return module.getComponent(ModuleRootManager.class); }
getInstance
293,832
Collection<VirtualFile> () { return Collections.emptyList(); }
getBinaryRoots
293,833
Set<VirtualFile> () { return Collections.emptySet(); }
getExcludedRoots
293,834
Condition<VirtualFile> () { return null; }
getExcludeFileCondition
293,835
Condition<VirtualFile> () { if (myConstantExcludeCondition == null) return null; Collection<VirtualFile> allRoots = getAllRoots(); return myConstantExcludeCondition.transformToCondition(allRoots); }
getConstantExcludeConditionAsCondition
293,836
Condition<VirtualFile> () { Condition<VirtualFile> condition = getExcludeFileCondition(); if (condition == null) return getConstantExcludeConditionAsCondition(); Condition<VirtualFile> otherCondition = getConstantExcludeConditionAsCondition(); if (otherCondition == null) return condition; return file -> condition.value(file) || otherCondition.value(file); }
getUnitedExcludeCondition
293,837
boolean () { return this instanceof ItemPresentation; }
isShowInExternalLibrariesNode
293,838
SyntheticLibrary (@NotNull List<? extends VirtualFile> sourceRoots) { return newImmutableLibrary(sourceRoots, Collections.emptySet(), null); }
newImmutableLibrary
293,839
SyntheticLibrary (@NotNull List<? extends VirtualFile> sourceRoots, @NotNull Set<? extends VirtualFile> excludedRoots, @Nullable Condition<? super VirtualFile> excludeCondition) { return newImmutableLibrary(sourceRoots, Collections.emptyList(), excludedRoots, excludeCondition); }
newImmutableLibrary
293,840
SyntheticLibrary (@NotNull List<? extends VirtualFile> sourceRoots, @NotNull List<? extends VirtualFile> binaryRoots, @NotNull Set<? extends VirtualFile> excludedRoots, @Nullable Condition<? super VirtualFile> excludeCondition) { return new ImmutableSyntheticLibrary(null, sourceRoots, binaryRoots, excludedRoots, excludeCondition, null); }
newImmutableLibrary
293,841
SyntheticLibrary (@NotNull String comparisonId, @NotNull List<? extends VirtualFile> sourceRoots, @NotNull List<? extends VirtualFile> binaryRoots, @NotNull Set<? extends VirtualFile> excludedRoots, @Nullable ExcludeFileCondition excludeCondition) { return new ImmutableSyntheticLibrary(comparisonId, sourceRoots, binaryRoots, excludedRoots, null, excludeCondition); }
newImmutableLibrary
293,842
Collection<VirtualFile> () { return getRoots(true, true); }
getAllRoots
293,843
Collection<VirtualFile> (boolean includeSources, boolean includeBinaries) { if (includeSources && includeBinaries) { Collection<VirtualFile> sourceRoots = getSourceRoots(); Collection<VirtualFile> binaryRoots = getBinaryRoots(); if (binaryRoots.isEmpty()) { return sourceRoots; } if (sourceRoots.isEmpty()) { return binaryRoots; } return ContainerUtil.union(sourceRoots, binaryRoots); } if (includeSources) { return getSourceRoots(); } if (includeBinaries) { return getBinaryRoots(); } return Collections.emptySet(); }
getRoots
293,844
boolean (@NotNull VirtualFile file, boolean includeSources, boolean includeBinaries) { Set<? extends VirtualFile> roots = asSet(getRoots(includeSources, includeBinaries)); return VfsUtilCore.isUnder(file, roots) && !VfsUtilCore.isUnder(file, getExcludedRoots()); }
contains
293,845
boolean (@NotNull VirtualFile file) { return contains(file, true, true); }
contains
293,846
boolean (@NotNull VirtualFile file, @NotNull Project project) { for (TestSourcesFilter filter : EP_NAME.getExtensionList()) { if (filter.isTestSource(file, project)) { return true; } } return false; }
isTestSources
293,847
void (@NotNull Project project, @Nullable @Nls String presentableLibraryName, @NotNull Collection<? extends VirtualFile> oldRoots, @NotNull Collection<? extends VirtualFile> newRoots, @NotNull String libraryNameForDebug) { AdditionalLibraryRootsListenerHelper.getInstance() .handleAdditionalLibraryRootsChanged(project, presentableLibraryName, oldRoots, newRoots, libraryNameForDebug); project.getMessageBus().syncPublisher(TOPIC).libraryRootsChanged(presentableLibraryName, oldRoots, newRoots, libraryNameForDebug); }
fireAdditionalLibraryChanged
293,848
ProjectRootManagerEx (Project project) { return (ProjectRootManagerEx)getInstance(project); }
getInstanceEx
293,849
LibraryTablesRegistrar () { return ApplicationManager.getApplication().getService(LibraryTablesRegistrar.class); }
getInstance
293,850
String () { return myKindId; }
getKindId
293,851
String () { return "LibraryKind:" + myKindId; }
toString
293,852
LibraryKind (@NotNull @NonNls String kindId) { return new LibraryKind(kindId); }
create
293,853
LibraryKind (String kindId) { return LibraryKindRegistry.getInstance().findKindById(kindId); }
findById
293,854
void (@NotNull LibraryKind kind) { ourAllKinds.remove(kind.getKindId()); }
unregisterKind
293,855
void (@NotNull LibraryKind kind) { ourAllKinds.put(kind.getKindId(), kind); }
registerKind
293,856
boolean (@NotNull Library library, @NotNull String fqn) { return isClassAvailableInLibrary(library.getFiles(OrderRootType.CLASSES), fqn); }
isClassAvailableInLibrary
293,857
boolean (VirtualFile @NotNull [] files, @NotNull String fqn) { return isClassAvailableInLibrary(Arrays.asList(files), fqn); }
isClassAvailableInLibrary
293,858
boolean (@NotNull List<? extends VirtualFile> files, @NotNull String fqn) { for (VirtualFile file : files) { if (findInFile(file, new StringTokenizer(fqn, "."))) return true; } return false; }
isClassAvailableInLibrary
293,859
boolean (@NotNull VirtualFile file, @NotNull StringTokenizer tokenizer) { if (!tokenizer.hasMoreTokens()) return true; @NonNls StringBuilder name = new StringBuilder(tokenizer.nextToken()); if (!tokenizer.hasMoreTokens()) { name.append(".class"); } final VirtualFile child = file.findChild(name.toString()); return child != null && findInFile(child, tokenizer); }
findInFile
293,860
Library (@NotNull LibraryTable libraryTable, @NonNls @NotNull String baseName) { String name = baseName; int count = 2; while (libraryTable.getLibraryByName(name) != null) { name = baseName + " (" + count++ + ")"; } return libraryTable.createLibrary(name); }
createLibrary
293,861
T (@Nullable VirtualFile virtualFile) { return key.get(virtualFile); }
getPersistentValue
293,862
boolean (@Nullable VirtualFile virtualFile, T value) { T oldValue = key.get(virtualFile); key.set(virtualFile, value); return !Objects.equals(oldValue, value); }
setPersistentValue
293,863
PushedFilePropertiesUpdater (@NotNull Project project) { return project.getService(PushedFilePropertiesUpdater.class); }
getInstance
293,864
void (@NotNull Element target, @NotNull Element subState) { mergeStateInto(target, subState, getSubStateTagName()); }
mergeStateInto
293,865
String (@NotNull Element element) { for (Element option : element.getChildren("option")) { if (option.getAttributeValue("name").equals("myName")) { return option.getAttributeValue("value"); } } throw new IllegalStateException(); }
getSubStateFileName
293,866
void (@NotNull Element target, @NotNull Element subState) { target.addContent(subState); }
mergeStateInto
293,867
void (@NotNull Element target, Element @NotNull [] elements) { throw new IllegalStateException(); }
mergeStatesInto
293,868
void (@NotNull Element target, @NotNull Element subState, @NotNull String subStateName) { if (subState.getName().equals(subStateName)) { target.addContent(subState); } else { JDOMUtil.merge(target, subState); } }
mergeStateInto
293,869
ProjectJdkTable () { return ApplicationManager.getApplication().getService(ProjectJdkTable.class); }
getInstance
293,870
void (@NotNull Sdk jdk, @NotNull Disposable parentDisposable) { Sdk existingJdk = findJdk(jdk.getName(), jdk.getSdkType().getName()); if (existingJdk != null && existingJdk.getSdkAdditionalData() == jdk.getSdkAdditionalData()) return; addJdk(jdk); Disposer.register(parentDisposable, () -> WriteAction.runAndWait(()-> removeJdk(jdk))); }
addJdk
293,871
void () { }
preconfigure
293,872
void (@Nullable String id) { this.id = id; }
setId
293,873
boolean (Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ProjectType type = (ProjectType)o; return Objects.equals(id, type.id); }
equals
293,874
int () { return id != null ? id.hashCode() : 0; }
hashCode
293,875
Set<String> (@Nullable Project project) { return ContainerUtil.map2Set(getProjectTypes(project), ProjectType::getId); }
getProjectTypeIds
293,876
Collection<ProjectType> (@Nullable Project project) { if (project == null) return emptyList(); if (project.isDefault()) return emptyList(); return CachedValuesManager.getManager(project).getCachedValue(project, PROJECT_TYPES_KEY, () -> { return Result.create(findProjectTypes(project), ProjectRootManager.getInstance(project), DumbService.getInstance(project)); }, false); }
getProjectTypes
293,877
Collection<ProjectType> (@NotNull Project project) { List<ProjectTypesProvider> providers = ProjectTypesProvider.EP_NAME.getExtensionList(); if (providers.isEmpty()) return emptyList(); return ReadAction.compute(() -> { if (DumbService.isDumb(project)) return emptyList(); return providers.stream() .flatMap(p -> p.inferProjectTypes(project).stream()) .toList(); }); }
findProjectTypes
293,878
void (@NotNull Project project, @NotNull ProjectType projectType) { getInstance(project).loadState(projectType); }
setProjectType
293,879
ProjectTypeService (@NotNull Project project) { return project.getService(ProjectTypeService.class); }
getInstance
293,880
ProjectType () { return myProjectType; }
getState
293,881
void (@NotNull ProjectType state) { myProjectType = state; }
loadState
293,882
void (@NotNull Project project) { getInstance(project).myProjectType = null; }
clearFieldsForLightProjectInTests
293,883
ProjectManager () { return ApplicationManager.getApplication().getService(ProjectManager.class); }
getInstance
293,884
ExternalStorageConfigurationManager (Project project) { return project.getService(ExternalStorageConfigurationManager.class); }
getInstance
293,885
Module (@NotNull Project project) { VirtualFile baseDir = project.getBaseDir(); if (baseDir == null) { return null; } ModuleManager moduleManager = ModuleManager.getInstance(project); return ContainerUtil.find(moduleManager.getModules(), module -> Arrays.asList(ModuleRootManager.getInstance(module).getContentRoots()).contains(baseDir)); }
getPrimaryModuleByContentRoot
293,886
Module (@NotNull Project project) { for (PrimaryModuleManager primaryModuleManager : EP_NAME.getExtensionList()) { Module primaryModule = primaryModuleManager.getPrimaryModule(project); if (primaryModule != null) { return primaryModule; } } return getPrimaryModuleByContentRoot(project); }
findPrimaryModule
293,887
ModulePointerManager (@NotNull Project project) { return project.getService(ModulePointerManager.class); }
getInstance
293,888
String () { return myModuleName; }
getModuleName
293,889
boolean (@NotNull Project project, @NotNull VirtualFile file, boolean isLibraryElement) { ProjectFileIndex projectFileIndex = ProjectFileIndex.getInstance(project); if (isLibraryElement) { List<OrderEntry> orders = projectFileIndex.getOrderEntriesForFile(file); for(OrderEntry orderEntry:orders) { if (orderEntry instanceof JdkOrderEntry || orderEntry instanceof LibraryOrderEntry) { return true; } } return false; } else { return projectFileIndex.isInContent(file); } }
projectContainsFile
293,890
String (@NotNull Module module) { return ReadAction.compute(module::getName); }
getModuleNameInReadAction
293,891
boolean (@NotNull PsiElement element) { if (!element.isValid()) return true; Project project = element.getProject(); ProjectFileIndex projectFileIndex = ProjectFileIndex.getInstance(project); PsiFile file = element.getContainingFile(); if (file == null) return true; VirtualFile vFile = file.getVirtualFile(); Module module = vFile == null ? null : projectFileIndex.getModuleForFile(vFile); // element may be in library return module == null ? !projectFileIndex.isInLibraryClasses(vFile) : module.isDisposed(); }
isModuleDisposed
293,892
Module (@Nullable PsiFile containingFile) { if (containingFile != null) { VirtualFile vFile = containingFile.getVirtualFile(); if (vFile != null) { return findModuleForFile(vFile, containingFile.getProject()); } } return null; }
findModuleForFile
293,893
Module (@NotNull VirtualFile file, @NotNull Project project) { if (project.isDefault()) { return null; } return ReadAction.compute(() -> ProjectFileIndex.getInstance(project).getModuleForFile(file)); }
findModuleForFile
293,894
Module (@NotNull PsiElement element) { PsiFile containingFile = element.getContainingFile(); PsiElement highestPsi = containingFile == null ? element : containingFile; if (!highestPsi.isValid()) { return null; } Project project = highestPsi.getProject(); if (project.isDefault()) return null; ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(project); if (element instanceof PsiFileSystemItem && (!(element instanceof PsiFile) || element.getContext() == null)) { VirtualFile vFile = ((PsiFileSystemItem)element).getVirtualFile(); if (vFile == null) { vFile = containingFile == null ? null : containingFile.getOriginalFile().getVirtualFile(); if (vFile == null) { return element.getUserData(KEY_MODULE); } } if (fileIndex.isInLibrary(vFile)) { List<OrderEntry> orderEntries = fileIndex.getOrderEntriesForFile(vFile); if (orderEntries.isEmpty()) { return null; } if (orderEntries.size() == 1 && orderEntries.get(0) instanceof LibraryOrSdkOrderEntry) { return orderEntries.get(0).getOwnerModule(); } Optional<Module> module = orderEntries .stream() .filter(entry -> entry instanceof LibraryOrSdkOrderEntry) .map(OrderEntry::getOwnerModule) .min(ModuleManager.getInstance(project).moduleDependencyComparator()); //there may be no LibraryOrSdkOrderEntry if the file is located under both module source root and a library root if (module.isPresent()) { return module.get(); } } return fileIndex.getModuleForFile(vFile); } if (containingFile != null) { PsiElement context; while ((context = containingFile.getContext()) != null) { PsiFile file = context.getContainingFile(); if (file == null) break; containingFile = file; } if (containingFile.getUserData(KEY_MODULE) != null) { return containingFile.getUserData(KEY_MODULE); } PsiFile originalFile = containingFile.getOriginalFile(); if (originalFile.getUserData(KEY_MODULE) != null) { return originalFile.getUserData(KEY_MODULE); } VirtualFile virtualFile = originalFile.getVirtualFile(); if (virtualFile != null) { return fileIndex.getModuleForFile(virtualFile); } } return element.getUserData(KEY_MODULE); }
findModuleForPsiElement
293,895
void (@NotNull Module module, @NotNull Set<? super Module> modules) { if (modules.contains(module)) return; modules.add(module); Module[] dependencies = ModuleRootManager.getInstance(module).getDependencies(); for (Module dependency : dependencies) { getDependencies(dependency, modules); } }
getDependencies
293,896
void (@NotNull Module module, @NotNull Set<? super Module> result) { if (!result.add(module)) { return; } ModuleManager moduleManager = ModuleManager.getInstance(module.getProject()); List<Module> dependentModules = moduleManager.getModuleDependentModules(module); for (Module dependentModule : dependentModules) { OrderEntry[] orderEntries = ModuleRootManager.getInstance(dependentModule).getOrderEntries(); for (OrderEntry o : orderEntries) { if (o instanceof ModuleOrderEntry orderEntry) { if (orderEntry.getModule() == module) { if (orderEntry.isExported()) { collectModulesDependsOn(dependentModule, result); } else { result.add(dependentModule); } break; } } } } }
collectModulesDependsOn
293,897
List<Module> (@NotNull Module module) { List<Module> list = new ArrayList<>(); Graph<Module> graph = ModuleManager.getInstance(module.getProject()).moduleGraph(); for (Iterator<Module> i = graph.getOut(module); i.hasNext();) { list.add(i.next()); } return list; }
getAllDependentModules
293,898
boolean (@NotNull Module module, @NotNull ModuleVisitor visitor) { if (!visitor.visit(module)) { return false; } List<Module> list = getAllDependentModules(module); for (Module dependentModule : list) { if (!visitor.visit(dependentModule)) { return false; } } return true; }
visitMeAndDependentModules
293,899
boolean (@NotNull Module module, @NotNull VirtualFile file, boolean isLibraryElement) { ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); if (isLibraryElement) { OrderEntry orderEntry = moduleRootManager.getFileIndex().getOrderEntryForFile(file); return orderEntry instanceof JdkOrderEntry || orderEntry instanceof LibraryOrderEntry; } else { return moduleRootManager.getFileIndex().isInContent(file); } }
moduleContainsFile