Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
277,700
DataNode<ProjectData> () { DataNode<ProjectData> projectNode = new DataNode<>(ProjectKeys.PROJECT, new ProjectData(ProjectSystemId.IDE, "externalName", "externalPath", "linkedPath"), null); projectNode.createChild(TestDataService.TEST_KEY, new Object()); return projectNode; }
createProjectDataStub
277,701
void (List<Thread> threads, int timeoutMillis) { for (Thread thread : threads) { try { thread.join(timeoutMillis); if (thread.isAlive()) { throw new RuntimeException("Failed to join thread in " + timeoutMillis + " ms."); } } catch (InterruptedException e) { throw new RuntimeException(e); } } }
joinAll
277,702
void (CountDownLatch latch) { try { latch.await(); } catch (InterruptedException e) { // do nothing } }
await
277,703
void (TestDataService... services) { ((ExtensionPointImpl<ProjectDataService<?,?>>)ProjectDataService.EP_NAME.getPoint()).maskAll(Arrays.asList(services), getTestRootDisposable(), false); }
maskProjectDataServices
277,704
void (Computable<? extends Collection<?>> toRemove, Collection<? extends DataNode<Object>> toIgnore, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { myTrace.add("removeDataAfter"); }
removeData
277,705
Computable<Collection<Object>> (Collection<? extends DataNode<Object>> toImport, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { myTrace.add("computeOrphanDataAfter"); return () -> Collections.emptyList(); }
computeOrphanData
277,706
void (Collection<? extends DataNode<Object>> toImport, @Nullable ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { myTrace.add("importDataAfter"); }
importData
277,707
Key () { return RUN_AFTER_KEY; }
getTargetDataKey
277,708
Key () { return TEST_KEY; }
getTargetDataKey
277,709
void (Computable<? extends Collection<?>> toRemove, Collection<? extends DataNode<Object>> toIgnore, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { myTrace.add("removeData"); }
removeData
277,710
Computable<Collection<Object>> (Collection<? extends DataNode<Object>> toImport, @NotNull ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { myTrace.add("computeOrphanData"); return () -> Collections.emptyList(); }
computeOrphanData
277,711
void (Collection<? extends DataNode<Object>> toImport, @Nullable ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { myTrace.add("importData"); }
importData
277,712
void (Collection<? extends DataNode<Object>> toImport, @Nullable ProjectData projectData, @NotNull Project project, @NotNull IdeModifiableModelsProvider modelsProvider) { if (isRunning.compareAndSet(false, true)) { try { Thread.sleep(100); } catch (InterruptedException e) { throw new RuntimeException(e); } finally { isRunning.set(false); } } else { wasConcurrent.set(true); } }
importData
277,713
boolean () { return wasConcurrent.get(); }
wasConcurrentRunDetected
277,714
void () { MessageCounter counter = new MessageCounter(); counter.increment(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.increment(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 2, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 2, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.increment(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 0, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.INFO, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.ERROR, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(null, NotificationSource.PROJECT_SYNC, NotificationCategory.WARNING, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 3, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.increment(GROUP2, NotificationSource.PROJECT_SYNC, NotificationCategory.SIMPLE, new ProjectSystemId("anotherBuildSystem")); assertEquals(counter.toString(), 2, counter.getCount(GROUP1, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 1, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.remove(GROUP2, NotificationSource.PROJECT_SYNC, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 0, counter.getCount(GROUP2, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); assertEquals(counter.toString(), 2, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); counter.remove(null, NotificationSource.PROJECT_SYNC, OTHER_BUILD_SYSTEM); assertEquals(counter.toString(), 0, counter.getCount(null, NotificationSource.PROJECT_SYNC, null, OTHER_BUILD_SYSTEM)); }
testIncrement
277,715
String () { return "FileDirName"; }
getName
277,716
String () { return IdeCoreBundle.message("macro.file.directory.name"); }
getDescription
277,717
String (@NotNull DataContext dataContext) { VirtualFile vFile = getVirtualDirOrParent(dataContext); return vFile != null ? vFile.getName() : null; }
expand
277,718
String () { return "/FileDirRelativeToSourcepath"; }
getName
277,719
String () { return IdeCoreBundle.message("macro.file.dir.relative.to.sourcepath.root.fwd.slash"); }
getDescription
277,720
String (@NotNull DataContext dataContext) { String s = super.expand(dataContext); return s != null ? s.replace(File.separatorChar, '/') : null; }
expand
277,721
String () { return "ModuleName"; }
getName
277,722
String () { return IdeCoreBundle.message("macro.module.file.name"); }
getDescription
277,723
String (@NotNull DataContext dataContext) { final Module module = PlatformCoreDataKeys.MODULE.getData(dataContext); if (module == null) { return null; } return module.getName(); }
expand
277,724
String () { return "FileNameWithoutAllExtensions"; }
getName
277,725
String () { return IdeCoreBundle.message("macro.file.name.without.all.extensions"); }
getDescription
277,726
String (@NotNull DataContext dataContext) { VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } String fileName = file.getName(); int index = fileName.indexOf('.'); return index > 0 ? fileName.substring(0, index) : fileName; }
expand
277,727
boolean (@NotNull Macro macro) { for (MacroFilter filter : EP_NAME.getExtensionList()) { if (!filter.accept(macro)) return false; } return true; }
accept
277,728
String () { return "FilePath"; }
getName
277,729
String () { return IdeCoreBundle.message("macro.file.path"); }
getDescription
277,730
String (@NotNull DataContext dataContext) { VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) return null; return getPath(file); }
expand
277,731
String () { return "/FileDirRelativeToProjectRoot"; }
getName
277,732
String () { return IdeCoreBundle.message("macro.file.dir.relative.to.root.fwd.slash"); }
getDescription
277,733
String (@NotNull DataContext dataContext) { String s = super.expand(dataContext); return s != null ? s.replace(File.separatorChar, '/') : null; }
expand
277,734
String () { return "FileDirPathFromParent"; }
getName
277,735
String () { return IdeCoreBundle.message("macro.file.directory.from.parent"); }
getDescription
277,736
String (@NotNull DataContext dataContext) { return null; }
expand
277,737
int (@NotNull CharSequence buffer, @NotNull String pattern, int maxIndex, boolean ignoreCase) { int patternLength = pattern.length(); int end = buffer.length() - patternLength; if (maxIndex > end) { maxIndex = end; } for (int i = maxIndex; i >= 0; i--) { boolean found = true; for (int j = 0; j < patternLength; j++) { if (ignoreCase) { if (!StringUtil.charsEqualIgnoreCase(pattern.charAt(j), buffer.charAt(i + j))) { found = false; break; } } else { if (pattern.charAt(j) != buffer.charAt(i + j)) { found = false; break; } } } if (found) { return i; } } return -1; }
lastIndexOf
277,738
String (@NotNull String path) { if (path.isEmpty()) { return PATH_DELIMITER; } boolean prepend = !path.startsWith(PATH_DELIMITER); boolean append = !path.endsWith(PATH_DELIMITER); if (prepend && append) { return PATH_DELIMITER + path + PATH_DELIMITER; } if (prepend) { path = PATH_DELIMITER + path; } if (append) { path += PATH_DELIMITER; } return path; }
surroundWithSlashes
277,739
MacroManager () { return ApplicationManager.getApplication().getService(MacroManager.class); }
getInstance
277,740
void (@NotNull Macro macro) { predefinedMacros.add(macro); }
registerMacro
277,741
Collection<Macro> () { return ContainerUtil.concat(predefinedMacros, Macro.EP_NAME.getExtensionList()); }
getMacros
277,742
DataContext (DataContext dataContext) { if (PlatformCoreDataKeys.FILE_EDITOR.getData(dataContext) != null) { return dataContext; } Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return dataContext; } FileEditorManager editorManager = FileEditorManager.getInstance(project); if (editorManager == null) { return dataContext; } VirtualFile[] files = editorManager.getSelectedFiles(); if (files.length == 0) { return dataContext; } FileEditor fileEditor = editorManager.getSelectedEditor(files[0]); return fileEditor == null ? dataContext : DataManager.getInstance().getDataContext(fileEditor.getComponent()); }
getCorrectContext
277,743
boolean (@Nullable String str) { if (str == null) return false; return MACRO_PATTERN.matcher(str).find(); }
containsMacros
277,744
String (@Nullable MacroPathConverter converter, @NotNull Macro macro, @NotNull String expandedValue) { if (converter == null) { return expandedValue; } if (macro instanceof PathMacro) { return converter.convertPath(expandedValue); } if (macro instanceof PathListMacro) { return converter.convertPathList(expandedValue); } return expandedValue; }
convertPathIfNeeded
277,745
String () { return "ModuleSourcePath"; }
getName
277,746
String () { return IdeCoreBundle.message("macro.module.source.path"); }
getDescription
277,747
String (@NotNull DataContext dataContext) { final Module module = PlatformCoreDataKeys.MODULE.getData(dataContext); if (module == null) { return null; } return OrderEnumerator.orderEntries(module).withoutSdk().withoutLibraries().getSourcePathsList().getPathsString(); }
expand
277,748
String () { return "FilePathRelativeToProjectRoot"; }
getName
277,749
String () { return IdeCoreBundle.message("macro.file.path.relative.to.root"); }
getDescription
277,750
String (@NotNull final DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return null; } VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } VirtualFile contentRoot = ProjectRootManager.getInstance(project).getFileIndex().getContentRootForFile(file); if (contentRoot != null && contentRoot.isDirectory()) { return FileUtil.getRelativePath(getIOFile(contentRoot), getIOFile(file)); } VirtualFile baseDirectory = BaseProjectDirectories.getInstance(project).getBaseDirectoryFor(file); if (baseDirectory != null) { return FileUtil.getRelativePath(getIOFile(baseDirectory), getIOFile(file)); } return null; }
expand
277,751
String () { return "ClipboardContent"; }
getName
277,752
String () { return IdeCoreBundle.message("macro.clipboard.content"); }
getDescription
277,753
String () { return "ModuleFilePath"; }
getName
277,754
String () { return IdeCoreBundle.message("macro.module.file.path"); }
getDescription
277,755
String (@NotNull DataContext dataContext) { final Module module = PlatformCoreDataKeys.MODULE.getData(dataContext); return module != null ? module.getModuleFilePath() : null; }
expand
277,756
String () { return "ModuleSdkPath"; }
getName
277,757
String () { return PlatformUtils.isPyCharm() ? ExecutionBundle.message("project.interpreter.path") : ExecutionBundle.message("module.sdk.path"); }
getDescription
277,758
String (@NotNull DataContext dataContext) { final Module module = PlatformCoreDataKeys.MODULE.getData(dataContext); if (module == null) { return null; } return JdkPathMacro.sdkPath(ModuleRootManager.getInstance(module).getSdk()); }
expand
277,759
String () { return "/FileRelativeDir"; }
getName
277,760
String () { return IdeCoreBundle.message("macro.file.directory.relative.fwd.slash"); }
getDescription
277,761
String (@NotNull DataContext dataContext) { String s = super.expand(dataContext); return s != null ? s.replace(File.separatorChar, '/') : null; }
expand
277,762
String () { return "FileParentDir"; }
getName
277,763
String () { return IdeCoreBundle.message("macro.file.parent.directory"); }
getDescription
277,764
String (@NotNull DataContext dataContext) { VirtualFile vFile = getVirtualDirOrParent(dataContext); return parentPath(vFile); }
expand
277,765
String (@Nullable VirtualFile vFile) { if(vFile != null) { vFile = vFile.getParent(); } return vFile != null ? getPath(vFile) : null; }
parentPath
277,766
String (Editor editor) { return getColumnNumber(editor, editor.getSelectionModel().getSelectionStart()); }
expand
277,767
String () { return "SourcepathEntry"; }
getName
277,768
String () { return IdeCoreBundle.message("macro.sourcepath.entry"); }
getDescription
277,769
String (@NotNull final DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return null; } VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } final VirtualFile sourceRoot = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(file); if (sourceRoot == null) { return null; } return getPath(sourceRoot); }
expand
277,770
String () { return "UnixSeparators"; }
getName
277,771
String () { return IdeCoreBundle.message("macro.unix.separators"); }
getDescription
277,772
String (@NotNull DataContext dataContext) { return null; }
expand
277,773
String () { return "/FileRelativePath"; }
getName
277,774
String () { return IdeCoreBundle.message("macro.file.path.relative.fwd.slash"); }
getDescription
277,775
String (@NotNull DataContext dataContext) { String s = super.expand(dataContext); return s != null ? s.replace(File.separatorChar, '/') : null; }
expand
277,776
String () { return "FileDir"; }
getName
277,777
String () { return IdeCoreBundle.message("macro.file.directory"); }
getDescription
277,778
String (@NotNull DataContext dataContext) { VirtualFile vFile = getVirtualDirOrParent(dataContext); return vFile != null ? getPath(vFile) : null; }
expand
277,779
String (Editor editor) { return getColumnNumber(editor, editor.getSelectionModel().getSelectionEnd()); }
expand
277,780
String () { return "FileEncoding"; }
getName
277,781
String () { return IdeCoreBundle.message("macro.file.encoding"); }
getDescription
277,782
String (@NotNull DataContext dataContext) { VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) return null; return file.getCharset().displayName(); }
expand
277,783
String () { return "FilePrompt"; }
getName
277,784
String () { return ExecutionBundle.message("shows.a.file.chooser.dialog"); }
getDescription
277,785
String (DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor(); final VirtualFile[] result = IdeUiService.getInstance().chooseFiles(descriptor, project, null); return result.length == 1? FileUtil.toSystemDependentName(result[0].getPath()) : null; }
promptUser
277,786
String () { return "FileDirRelativeToSourcepath"; }
getName
277,787
String () { return IdeCoreBundle.message("macro.file.dir.relative.to.sourcepath.root"); }
getDescription
277,788
String (@NotNull final DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return null; } VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } if (!file.isDirectory()) { file = file.getParent(); if (file == null) { return null; } } final VirtualFile sourceRoot = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(file); if (sourceRoot == null) return null; return FileUtil.getRelativePath(getIOFile(sourceRoot), getIOFile(file)); }
expand
277,789
String (Editor editor) { return getColumnNumber(editor, editor.getCaretModel().getLogicalPosition()); }
expand
277,790
String () { return "FileDirRelativeToProjectRoot"; }
getName
277,791
String () { return IdeCoreBundle.message("macro.file.dir.relative.to.root"); }
getDescription
277,792
String (@NotNull final DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return null; } VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } if (!file.isDirectory()) { file = file.getParent(); if (file == null) { return null; } } VirtualFile contentRoot = ProjectRootManager.getInstance(project).getFileIndex().getContentRootForFile(file); if (contentRoot != null && contentRoot.isDirectory()) { return FileUtil.getRelativePath(getIOFile(contentRoot), getIOFile(file)); } final VirtualFile baseDirectory = BaseProjectDirectories.getInstance(project).getBaseDirectoryFor(file); if (baseDirectory != null) { return FileUtil.getRelativePath(getIOFile(baseDirectory), getIOFile(file)); } return null; }
expand
277,793
String () { return "/FilePathRelativeToProjectRoot"; }
getName
277,794
String () { return IdeCoreBundle.message("macro.file.path.relative.to.root.fwd.slash"); }
getDescription
277,795
String (@NotNull DataContext dataContext) { String s = super.expand(dataContext); return s != null ? s.replace(File.separatorChar, '/') : null; }
expand
277,796
String () { return "FileNameWithoutExtension"; }
getName
277,797
String () { return IdeCoreBundle.message("macro.file.name.without.extension"); }
getDescription
277,798
String (@NotNull DataContext dataContext) { VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } return file.getNameWithoutExtension(); }
expand
277,799
String () { return "Projectpath"; }
getName