Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
72,100
void () { PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); Application application = ApplicationManager.getApplication(); if (propertiesComponent.getBoolean(DEFAULT_JDK_CONFIGURED, false) || application.isUnitTestMode()) return; try { Sdk jdk = ProgressManager.getInstance().runProcessWithPro...
preconfigure
72,101
Sdk () { if (myInternalJdk == null) { Path javaHome = Paths.get(SystemProperties.getJavaHome()); if (JdkUtil.checkForJre(javaHome) && !JdkUtil.checkForJdk(javaHome)) { // handle situation like javaHome="<somewhere>/jdk1.8.0_212/jre" (see IDEA-226353) Path javaHomeParent = javaHome.getParent(); if (javaHomeParent != nul...
getInternalJdk
72,102
void (@NotNull Sdk jdk) { super.removeJdk(jdk); if (jdk.equals(myInternalJdk)) { myInternalJdk = null; } }
removeJdk
72,103
SdkTypeId () { return JavaSdk.getInstance(); }
getDefaultSdkType
72,104
void (@NotNull Element element) { myInternalJdk = null; super.loadState(element); }
loadState
72,105
void () { WriteAction.run(()-> { JavaAwareProjectJdkTableImpl table = getInstanceEx(); if (table.myInternalJdk != null) { table.removeJdk(table.myInternalJdk); } }); }
removeInternalJdkInTests
72,106
void (@NotNull List<? extends @NotNull VFileEvent> events) { for (VFileEvent event : events) { if (event instanceof VFileContentChangeEvent || event instanceof VFileDeleteEvent) { updateCache(event, PathUtil.getFileName(event.getPath())); break; } else if (event instanceof VFileCreateEvent) { updateCache(event, ((VFile...
after
72,107
void (@NotNull VFileEvent event, @NotNull String fileName) { if (ArchiveFileType.INSTANCE.equals(FileTypeManager.getInstance().getFileTypeByFileName(fileName))) { String filePath = event.getPath(); if (myCachedSdkHomeToInfo.keySet().removeIf(sdkHome -> FileUtil.isAncestor(sdkHome, filePath, false))) { myCachedVersionSt...
updateCache
72,108
String () { return ProjectBundle.message("sdk.java.name"); }
getPresentableName
72,109
Icon () { return AllIcons.Nodes.PpJdk; }
getIcon
72,110
String () { return "reference.project.structure.sdk.java"; }
getHelpTopic
72,111
String () { return "https://www.oracle.com/technetwork/java/javase/downloads/index.html"; }
getDownloadSdkUrl
72,112
AdditionalDataConfigurable (@NotNull SdkModel sdkModel, @NotNull SdkModificator sdkModificator) { return null; }
createAdditionalDataConfigurable
72,113
void (@NotNull SdkAdditionalData additionalData, @NotNull Element additional) { }
saveAdditionalData
72,114
Comparator<Sdk> () { return (sdk1, sdk2) -> { assert sdk1.getSdkType() == this : sdk1; assert sdk2.getSdkType() == this : sdk2; return Comparing.compare(getJavaVersion(sdk1), getJavaVersion(sdk2)); }; }
versionComparator
72,115
Comparator<String> () { return (sdk1, sdk2) -> Comparing.compare(getJavaVersion(sdk1), getJavaVersion(sdk2)); }
versionStringComparator
72,116
String (@NotNull Sdk sdk) { return getConvertedHomePath(sdk) + "bin"; }
getBinPath
72,117
String (@NotNull Sdk sdk) { JavaVersion version = getJavaVersion(sdk); return version == null || version.feature > 9 ? null : getConvertedHomePath(sdk) + "lib" + File.separator + (version.feature < 2 ? "classes.zip" : "tools.jar"); }
getToolsPath
72,118
String (@NotNull Sdk sdk) { String binPath = getBinPath(sdk); if (WslPath.isWslUncPath(binPath)) { return binPath + "/java"; } return binPath + File.separator + VM_EXE_NAME; }
getVMExecutablePath
72,119
String (@NotNull Sdk sdk) { String homePath = sdk.getHomePath(); assert homePath != null : sdk; String path = FileUtil.toSystemDependentName(homePath); if (!path.endsWith(File.separator)) { path += File.separator; } return path; }
getConvertedHomePath
72,120
String () { return JavaHomeFinder.defaultJavaLocation(); }
suggestHomePath
72,121
Collection<String> () { return JavaHomeFinder.suggestHomePaths(); }
suggestHomePaths
72,122
String (@NotNull String homePath) { if (SystemInfo.isMac) { Path home = Path.of(homePath, "/Home"); if (Files.exists(home)) return home.toString(); home = Path.of(homePath, "Contents/Home"); if (Files.exists(home)) return home.toString(); } return homePath; }
adjustSelectedSdkHome
72,123
boolean (@NotNull String path) { return JdkUtil.checkForJdk(path); }
isValidSdkHome
72,124
String (@NotNull String path) { if (JdkUtil.checkForJre(path)) { return "The selected directory points to a JRE, not a JDK.\nYou can download a JDK from " + getDownloadSdkUrl(); } return super.getInvalidHomeMessage(path); }
getInvalidHomeMessage
72,125
String (@Nullable String currentSdkName, @NotNull String sdkHome) { JdkVersionDetector.JdkVersionInfo info = getInfo(sdkHome); if (info == null) return currentSdkName != null ? currentSdkName : ""; String vendorPrefix = Registry.is("use.jdk.vendor.in.suggested.jdk.name", true) ? info.variant.prefix : null; String name ...
suggestSdkName
72,126
boolean (@NotNull Sdk sdk, @NotNull SdkModel sdkModel) { setupSdkPaths(sdk); if (sdk.getSdkModificator().getRoots(OrderRootType.CLASSES).length == 0) { String title = JavaBundle.message("sdk.cannot.create"); String message = JavaBundle.message("sdk.java.no.classes", sdk.getHomePath()); Messages.showMessageDialog(messag...
setupSdkPaths
72,127
void (@NotNull Sdk sdk) { Runnable sdkSetter = ()->{ String homePath = sdk.getHomePath(); assert homePath != null : sdk; Path jdkHome = Path.of(homePath); SdkModificator sdkModificator = sdk.getSdkModificator(); List<String> classes = findClasses(jdkHome, false); Set<String> previousRoots = new LinkedHashSet<>(Arrays.a...
setupSdkPaths
72,128
void (@NotNull SdkModificator modificator) { attachIDEAAnnotationsToJdk(modificator); }
attachJdkAnnotations
72,129
boolean (@NotNull SdkModificator modificator) { List<String> pathsChecked = new ArrayList<>(); VirtualFile root = internalJdkAnnotationsPath(pathsChecked, false); if (root != null && !isInternalJdkAnnotationRootCorrect(root)) { root = null; } if (root == null) { String msg = "Paths checked:\n"+ StringUtil.join(pathsChe...
attachIDEAAnnotationsToJdk
72,130
Promise<Boolean> (@NotNull Sdk sdk) { return ReadAction.nonBlocking(() -> { List<String> pathsChecked = new ArrayList<>(); VirtualFile root = internalJdkAnnotationsPath(pathsChecked, false); if (root != null && !isInternalJdkAnnotationRootCorrect(root)) { root = null; } if (root == null) { String msg = "Paths checked:\...
attachIDEAAnnotationsToJdkAsync
72,131
boolean (@NotNull VirtualFile root) { String relPath = "java/awt/event/annotations.xml"; VirtualFile xml = root.findFileByRelativePath(relPath); if (xml == null) { reportCorruptedJdkAnnotations(root, "there's no file " + root.getPath() + "/" + relPath); return false; } MostlySingularMultiMap<String, BaseExternalAnnotat...
isInternalJdkAnnotationRootCorrect
72,132
void (@NotNull VirtualFile root, @NotNull @NlsSafe String reason) { LOG.warn("Internal jdk annotation root " + root + " seems corrupted: " + reason); }
reportCorruptedJdkAnnotations
72,133
VirtualFile (@NotNull List<? super String> pathsChecked, boolean refresh) { Path javaPluginClassesRootPath = PathManager.getJarForClass(JavaSdkImpl.class); LOG.assertTrue(javaPluginClassesRootPath != null); javaPluginClassesRootPath = javaPluginClassesRootPath.toAbsolutePath(); VirtualFile root; VirtualFileManager vfm ...
internalJdkAnnotationsPath
72,134
String (@NotNull String sdkHome) { var info = getInfo(sdkHome); if (info == null) return null; return info.displayVersionString(); }
getVersionString
72,135
JavaSdkVersion (@NotNull Sdk sdk) { JavaVersion version = getJavaVersion(sdk); return version != null ? JavaSdkVersion.fromJavaVersion(version) : null; }
getVersion
72,136
boolean (@NotNull Sdk sdk, @NotNull JavaSdkVersion version) { JavaSdkVersion sdkVersion = getVersion(sdk); return sdkVersion != null && sdkVersion.isAtLeast(version); }
isOfVersionOrHigher
72,137
Sdk (@NotNull String jdkName, @NotNull String home, boolean isJre) { Path jdkHomePath = Path.of(home); if (!Files.exists(jdkHomePath)) { throw new IllegalArgumentException(jdkHomePath.toAbsolutePath() + " doesn't exist"); } ProjectJdkImpl jdk = new ProjectJdkImpl(jdkName, this); SdkModificator sdkModificator = jdk.getS...
createJdk
72,138
void (@NotNull Path file, @NotNull SdkModificator sdkModificator, boolean isJre) { for (String url : findClasses(file, isJre)) { sdkModificator.addRoot(url, OrderRootType.CLASSES); } }
addClasses
72,139
List<String> (@NotNull Path jdkHome, boolean isJre) { List<String> result = new ArrayList<>(); if (JdkUtil.isExplodedModularRuntime(jdkHome)) { try { try (DirectoryStream<Path> roots = Files.newDirectoryStream(jdkHome.resolve("modules"))) { for (Path root : roots) { result.add(VfsUtil.getUrlForLibraryRoot(root)); } } }...
findClasses
72,140
void (@NotNull Path jdkHome, @NotNull SdkModificator sdkModificator) { VirtualFile jdkSrc = findSources(jdkHome, "src"); if (jdkSrc != null) { if (jdkSrc.findChild("java.base") != null) { for (VirtualFile root : jdkSrc.getChildren()) { if (root.isDirectory()) { sdkModificator.addRoot(root, OrderRootType.SOURCES); } } }...
addSources
72,141
void (@NotNull Path jdkHome, @NotNull SdkModificator sdkModificator, @Nullable Sdk sdk) { OrderRootType docRootType = JavadocOrderRootType.getInstance(); VirtualFile apiDocs = findDocs(jdkHome, "docs/api"); if (apiDocs != null) { sdkModificator.addRoot(apiDocs, docRootType); } else if (SystemInfo.isMac) { VirtualFile c...
addDocs
72,142
String (@NotNull Path path) { return FileUtil.toSystemIndependentName(path.toAbsolutePath().toString()); }
vfsPath
72,143
boolean (@NotNull OrderRootType type) { return type == OrderRootType.CLASSES || type == OrderRootType.SOURCES || type == JavadocOrderRootType.getInstance() || type == AnnotationOrderRootType.getInstance(); }
isRootTypeApplicable
72,144
boolean (@NotNull Sdk sdk) { return sdk.getSdkType() instanceof JavaSdkType; }
isValidDependency
72,145
String () { return JavaBundle.message("dependant.sdk.unsatisfied.dependency.message"); }
getUnsatisfiedDependencyMessage
72,146
SdkType () { return JavaSdk.getInstance(); }
getDependencyType
72,147
boolean () { return true; }
isDependent
72,148
VirtualFile (final Module searchFromModule, final String fileName) { return findResourceFileInScope(fileName, searchFromModule.getProject(), searchFromModule.getModuleWithDependenciesScope()); }
findResourceFileInDependents
72,149
VirtualFile (final Project project, final String resourceName) { return findResourceFileInScope(resourceName, project, GlobalSearchScope.projectScope(project)); }
findResourceFileInProject
72,150
VirtualFile (final String resourceName, final Project project, final GlobalSearchScope scope) { int index = resourceName.lastIndexOf('/'); String packageName = index >= 0 ? resourceName.substring(0, index).replace('/', '.') : ""; final String fileName = index >= 0 ? resourceName.substring(index+1) : resourceName; final...
findResourceFileInScope
72,151
void () { if (myWebModuleType != null) { ModuleTypeManager.getInstance().unregisterModuleType(myWebModuleType); } }
dispose
72,152
JavaModuleBuilder () { return new JavaModuleBuilder(); }
createModuleBuilder
72,153
String () { return getModuleName(); }
getName
72,154
String () { return JavaBundle.message("module.type.java.description"); }
getDescription
72,155
Icon (boolean isOpened) { return getJavaModuleNodeIconClosed(); }
getNodeIcon
72,156
ModuleWizardStep (@NotNull SettingsStep settingsStep, @NotNull final ModuleBuilder moduleBuilder) { return ProjectWizardStepFactory.getInstance().createJavaSettingsStep(settingsStep, moduleBuilder, moduleBuilder::isSuitableSdkType); }
modifyProjectTypeStep
72,157
Icon () { return AllIcons.Nodes.Module; }
getJavaModuleNodeIconClosed
72,158
boolean (@NotNull final Module module, final Sdk projectSdk) { return isValidJavaSdk(module); }
isValidSdk
72,159
boolean (@NotNull Module module) { if (ModuleRootManager.getInstance(module).getSourceRoots(JavaModuleSourceRootTypes.SOURCES).isEmpty()) return true; JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(module.getProject()); return ReadAction.compute(() -> psiFacade.findClass(CommonClassNames.JAVA_LANG_OBJECT, module.g...
isValidJavaSdk
72,160
String () { return IJ_BASE_PACKAGE; }
getParameterId
72,161
WizardInputField (final String defaultValue) { return new WizardInputField<JTextField>(IJ_BASE_PACKAGE, defaultValue) { private final JTextField myField; { @NlsSafe final String value = PropertiesComponent.getInstance().getValue(IJ_BASE_PACKAGE, defaultValue); myField = new JTextField(value); } @Override public @NlsCon...
createField
72,162
JTextField () { return myField; }
getComponent
72,163
String () { return myField.getText(); }
getValue
72,164
String (Project project) { PsiPackage root = JavaPsiFacade.getInstance(project).findPackage(""); if (root == null) return null; String name = getBasePackage(root, GlobalSearchScope.projectScope(project)).getQualifiedName(); return StringUtil.isEmpty(name) ? null : name; }
detectParameterValue
72,165
PsiPackage (PsiPackage pack, GlobalSearchScope scope) { List<PsiPackage> subPackages = ContainerUtil.filter(pack.getSubPackages(scope), PACKAGE_CONDITION); return subPackages.size() == 1 ? getBasePackage(subPackages.get(0), scope) : pack; }
getBasePackage
72,166
String () { return IJ_LANGUAGE_LEVEL; }
getParameterId
72,167
WizardInputField (String defaultValue) { return null; }
createField
72,168
String () { return LanguageLevelProjectExtension.getInstance(ProjectManager.getInstance().getDefaultProject()).getLanguageLevel().name(); }
getImmediateValue
72,169
String (Project project) { return null; }
detectParameterValue
72,170
void (String value, ModifiableRootModel model) { try { boolean aDefault = LanguageLevelProjectExtension.getInstance(ProjectManager.getInstance().getDefaultProject()).isDefault(); if (aDefault) { LanguageLevelProjectExtension.getInstance(model.getProject()).setDefault(true); } else { LanguageLevel level = LanguageLevel....
applyResult
72,171
SdkType () { return JavaSdk.getInstance(); }
getJavaSdkType
72,172
Sdk () { return JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk(); }
getInternalJdk
72,173
Sdk (@Nullable String jdkName, @NotNull String homePath) { SdkType javaSdk = getJavaSdkType(); String sdkName = jdkName != null ? jdkName : javaSdk.suggestSdkName(null, homePath); return ((JavaSdk)javaSdk).createJdk(sdkName, homePath, !JdkUtil.checkForJdk(homePath)); }
createJdk
72,174
void (@NotNull IdeModifiableModelsProvider modelsProvider, @NotNull Module module, @NotNull ModuleData data) { if (ModuleTypeId.JAVA_MODULE.equals(module.getModuleTypeName())) { ModifiableRootModel modifiableRootModel = modelsProvider.getModifiableRootModel(module); setLanguageLevel(modifiableRootModel, data); setBytec...
importModule
72,175
void (@NotNull ModifiableRootModel modifiableRootModel, ModuleData data) { if (!data.isSetSourceCompatibility()) return; LanguageLevel level = LanguageLevel.parse(data.getSourceCompatibility()); if (level != null) { try { modifiableRootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(level)...
setLanguageLevel
72,176
void (@NotNull Module module, @NotNull ModuleData data) { if (!data.isSetTargetCompatibility()) return; String targetLevel = data.getTargetCompatibility(); if (targetLevel != null) { CompilerConfiguration configuration = CompilerConfiguration.getInstance(module.getProject()); configuration.setBytecodeTargetLevel(module...
setBytecodeTargetLevel
72,177
TextAttributes (@Nullable TextAttributes source) { EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); final TextAttributes changedColor = globalScheme.getAttributes(DiffColors.DIFF_MODIFIED); if (source == null) { TextAttributes attrs = globalScheme.getAttributes(DefaultLanguageHighl...
getTextAttributes
72,178
boolean () { return mySettings.isShow(); }
shouldRunHeavy
72,179
void (@NotNull final Document copiedFragment, int startOffset, int startLineNumber, @NotNull Consumer<? super AdditionalHighlight> consumer) { VcsContentAnnotation vcsContentAnnotation = VcsContentAnnotationImpl.getInstance(myProject); final LocalChangesCorrector localChangesCorrector = new LocalChangesCorrector(myProj...
applyHeavyFilter
72,180
String () { return VcsBundle.message("checking.recent.changes"); }
getUpdateMessage
72,181
UpToDateLineNumberProvider (@NotNull VirtualFile vf, @NotNull Document document) { UpToDateLineNumberProvider provider = myRecentlyChanged.get(vf); if (provider == null) { provider = new UpToDateLineNumberProviderImpl(document, myProject); myRecentlyChanged.put(vf, provider); } return provider; }
getProvider
72,182
Document (@NotNull ExceptionLineParser worker) { return ReadAction.compute(() -> { final Document document = FileDocumentManager.getInstance().getDocument(worker.getFile().getVirtualFile()); if (document == null) { LOG.info("can not get document for file: " + worker.getFile().getVirtualFile()); return null; } return do...
getDocumentForFile
72,183
List<TextRange> (final ExceptionLineParser worker, final Document document, final LineResult previousLineResult) { return ReadAction.compute(() -> { List<TextRange> ranges = getTextRangeForMethod(worker, previousLineResult); if (ranges == null) return null; final List<TextRange> result = new ArrayList<>(); for (TextRan...
findMethodRange
72,184
List<UMethod> (List<UMethod> methods, final LineResult previousLineResult) { if (previousLineResult == null || previousLineResult.method() == null) return null; final List<UMethod> result = new SmartList<>(); for (final UMethod method : methods) { PsiElement psi = method.getSourcePsi(); if (psi == null) continue; psi.a...
selectMethod
72,185
void (@NotNull PsiElement element) { super.visitElement(element); UCallExpression call = UastContextKt.toUElement(element, UCallExpression.class); if (call != null) { PsiMethod resolved = call.resolve(); if (resolved != null && resolved.getName().equals(previousLineResult.method())) { result.add(method); stopWalking();...
visitElement
72,186
List<TextRange> (final ExceptionLineParser worker, LineResult previousLineResult) { String method = worker.getMethod().replaceFirst("\\$lambda\\$\\d+$", "") .replaceFirst("^lambda\\$(.+)\\$\\d+$", "$1"); UClass psiClass = worker.getUClass(); if (psiClass == null) return null; List<UMethod> methods; if (method.contains(...
getTextRangeForMethod
72,187
Result (@NotNull String line, int entireLength) { return null; }
applyFilter
72,188
Filter (@NotNull GlobalSearchScope searchScope) { return new VcsContentAnnotationExceptionFilter(Objects.requireNonNull(searchScope.getProject()), searchScope); }
create
72,189
Filter (@NotNull Project project, @NotNull GlobalSearchScope searchScope) { return new VcsContentAnnotationExceptionFilter(project, searchScope); }
create
72,190
Icon () { return JavaFileType.INSTANCE.getIcon(); }
getIcon
72,191
SyntaxHighlighter () { return new JavaFileHighlighter(LanguageLevel.HIGHEST); }
getHighlighter
72,192
String () { return "/* Block comment */\n" + "import <class>java.util.Date</class>;\n" + "import static <interface>AnInterface</interface>.<static_final>CONSTANT</static_final>;\n" + "import static <class>java.util.Date</class>.<static_method>parse</static_method>;\n" + "import static <class>SomeClass</class>.<static>s...
getDemoText
72,193
boolean (TextAttributesKey type) { return JavaHighlightingColors.LOCAL_VARIABLE_ATTRIBUTES.equals(type) || JavaHighlightingColors.REASSIGNED_LOCAL_VARIABLE_ATTRIBUTES.equals(type) || JavaHighlightingColors.PARAMETER_ATTRIBUTES.equals(type) || JavaHighlightingColors.REASSIGNED_PARAMETER_ATTRIBUTES.equals(type) || JavaHi...
isRainbowType
72,194
Language () { return JavaLanguage.INSTANCE; }
getLanguage
72,195
void () { super.clearCaches(); synchronized (this) { FileSystem fs = dereference(myFileSystem); if (fs != null) { myFileSystem = null; try { fs.close(); } catch (Exception e) { Logger.getInstance(JrtHandler.class).info(e); } } } }
clearCaches
72,196
void () { myHandlers.forEach((k, handler) -> handler.clearCaches()); myHandlers.clear(); }
dispose
72,197
String () { return PROTOCOL; }
getProtocol
72,198
String (@NotNull String rootPath) { return StringUtil.trimEnd(rootPath, SEPARATOR); }
extractLocalPath
72,199
String (@NotNull String localPath) { return localPath + SEPARATOR; }
composeRootPath