Unnamed: 0 int64 0 305k | body stringlengths 7 52.9k | name stringlengths 1 185 |
|---|---|---|
277,800 | String () { return IdeCoreBundle.message("macro.project.source.path"); } | getDescription |
277,801 | String (@NotNull DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) return null; return OrderEnumerator.orderEntries(project).withoutSdk().withoutLibraries().getSourcePathsList().getPathsString(); } | expand |
277,802 | String () { return "OSName"; } | getName |
277,803 | String () { return IdeCoreBundle.message("macro.os.name"); } | getDescription |
277,804 | String (@NotNull DataContext dataContext) { String osName = SystemInfoRt.OS_NAME.toLowerCase(Locale.ENGLISH); int firstSpace = osName.indexOf(' '); return firstSpace < 0 ? osName : osName.substring(0, firstSpace); } | expand |
277,805 | String () { return "FilePathRelativeToSourcepath"; } | getName |
277,806 | String () { return IdeCoreBundle.message("macro.file.path.relative.to.sourcepath.root"); } | getDescription |
277,807 | 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 FileUtil.getRelativePath(getIOFile(sourceRoot), getIOFile(file)); } | expand |
277,808 | String () { return "JDKPath"; } | getName |
277,809 | String () { return IdeCoreBundle.message("macro.jdk.path"); } | getDescription |
277,810 | String (@NotNull DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return null; } final Sdk anyJdk = PathUtilEx.getAnyJdk(project); return sdkPath(anyJdk); } | expand |
277,811 | String (@Nullable Sdk anyJdk) { if (anyJdk == null) { return null; } String jdkHomePath = PathUtil.getLocalPath(anyJdk.getHomeDirectory()); if (jdkHomePath != null) { jdkHomePath = jdkHomePath.replace('/', File.separatorChar); } return jdkHomePath; } | sdkPath |
277,812 | String (Editor editor) { return String.valueOf(editor.getCaretModel().getLogicalPosition().line + 1); } | expand |
277,813 | String (Editor editor) { return String.valueOf(getLineNumber(editor, editor.getSelectionModel().getSelectionStart()) + 1); } | expand |
277,814 | String () { return "ProjectFileDir"; } | getName |
277,815 | String () { return IdeCoreBundle.message("macro.project.file.directory"); } | getDescription |
277,816 | String (@NotNull DataContext dataContext) { final VirtualFile baseDir = PlatformCoreDataKeys.PROJECT_FILE_DIRECTORY.getData(dataContext); if (baseDir == null) { return null; } return VfsUtil.virtualToIoFile(baseDir).getPath(); } | expand |
277,817 | String () { return "FileExt"; } | getName |
277,818 | String () { return IdeCoreBundle.message("macro.file.extension"); } | getDescription |
277,819 | String (@NotNull DataContext dataContext) { VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) { return null; } return file.getExtension(); } | expand |
277,820 | String () { return "/FilePathRelativeToSourcepath"; } | getName |
277,821 | String () { return IdeCoreBundle.message("macro.file.path.relative.to.sourcepath.root.fwd.slash"); } | getDescription |
277,822 | String (@NotNull DataContext dataContext) { String s = super.expand(dataContext); return s != null ? s.replace(File.separatorChar, '/') : null; } | expand |
277,823 | String () { return "Sourcepath"; } | getName |
277,824 | String () { return IdeCoreBundle.message("macro.project.sourcepath"); } | getDescription |
277,825 | String (@NotNull DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) return null; return OrderEnumerator.orderEntries(project).withoutSdk().withoutLibraries().getSourcePathsList().getPathsString(); } | expand |
277,826 | String () { return myName; } | getName |
277,827 | String () { return myDescription; } | getDescription |
277,828 | String (@NotNull DataContext dataContext) { Editor editor = CommonDataKeys.EDITOR.getData(dataContext); if (editor != null){ return expand(editor); } return null; } | expand |
277,829 | String (Editor editor, LogicalPosition pos) { if (EditorCoreUtil.inVirtualSpace(editor, pos)) { return String.valueOf(pos.column + 1); } int offset = editor.logicalPositionToOffset(pos); return getColumnNumber(editor, offset); } | getColumnNumber |
277,830 | String (Editor editor, int offset) { int lineNumber = getLineNumber(editor, offset); int lineStart = editor.getDocument().getLineStartOffset(lineNumber); return String.valueOf(offset - lineStart + 1); } | getColumnNumber |
277,831 | int (Editor editor, int offset) { return editor.getDocument().getLineNumber(offset); } | getLineNumber |
277,832 | String (Editor editor) { return editor.getSelectionModel().getSelectedText(); } | expand |
277,833 | String () { return "IsMake"; } | getName |
277,834 | String () { return IdeCoreBundle.message("macro.compiler.context.is.make"); } | getDescription |
277,835 | String (@NotNull DataContext dataContext) { Boolean make = dataContext.getData(COMPILER_CONTEXT_MAKE_KEY); return make != null ? make.toString() : null; } | expand |
277,836 | String () { return "FileName"; } | getName |
277,837 | String () { return IdeCoreBundle.message("macro.file.name"); } | getDescription |
277,838 | String (@NotNull DataContext dataContext) { VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) return null; return file.getName(); } | expand |
277,839 | String () { return "FileRelativeDir"; } | getName |
277,840 | String () { return IdeCoreBundle.message("macro.file.directory.relative"); } | getDescription |
277,841 | String (@NotNull DataContext dataContext) { final VirtualFile baseDir = PlatformCoreDataKeys.PROJECT_FILE_DIRECTORY.getData(dataContext); if (baseDir == null) { return null; } VirtualFile dir = getVirtualDirOrParent(dataContext); if (dir == null) return null; return FileUtil.getRelativePath(VfsUtilCore.virtualToIoFile(baseDir), VfsUtilCore.virtualToIoFile(dir)); } | expand |
277,842 | String () { return "ModuleFileDir"; } | getName |
277,843 | String () { return IdeCoreBundle.message("macro.module.file.directory"); } | getDescription |
277,844 | String (@NotNull DataContext dataContext) { final Module module = PlatformCoreDataKeys.MODULE.getData(dataContext); final String path = module != null ? module.getModuleFilePath() : null; if (path == null) { return null; } final File fileDir = new File(path).getParentFile(); if (fileDir == null) { return null; } return fileDir.getPath(); } | expand |
277,845 | void (@NotNull Set<String> result) { for (Macro macro : MacroManager.getInstance().getMacros()) { result.remove(macro.getName()); } } | removeToolMacroNames |
277,846 | String () { return "AffectedModuleNames"; } | getName |
277,847 | String () { return IdeCoreBundle.message("macro.affected.module.names"); } | getDescription |
277,848 | String (@NotNull DataContext dataContext) { final Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext); if (modules == null) { return null; } return StringUtil.join(modules, Module::getName, ","); } | expand |
277,849 | String () { return "ProjectName"; } | getName |
277,850 | String () { return IdeCoreBundle.message("macro.project.file.name"); } | getDescription |
277,851 | String (@NotNull DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project == null) { return null; } return project.getName(); } | expand |
277,852 | String (@NotNull VirtualFile file) { return file.getPath().replace('/', File.separatorChar); } | getPath |
277,853 | File (@NotNull VirtualFile file) { return new File(getPath(file)); } | getIOFile |
277,854 | VirtualFile (@NotNull DataContext dataContext) { VirtualFile vFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (vFile != null && !vFile.isDirectory()) { vFile = vFile.getParent(); } return vFile; } | getVirtualDirOrParent |
277,855 | String (@NotNull DataContext dataContext) { return myValue; } | expand |
277,856 | String () { return myDelegate.getDescription(); } | getDescription |
277,857 | String () { return myDelegate.getName(); } | getName |
277,858 | String () { return "Prompt"; } | getName |
277,859 | String () { return IdeCoreBundle.message("macro.prompt"); } | getDescription |
277,860 | String (DataContext dataContext) { return promptUser(); } | promptUser |
277,861 | String () { return MessagesService.getInstance().showInputDialog(null, null, IdeCoreBundle.message("prompt.enter.parameters"), IdeCoreBundle.message("title.input"), UIUtil.getQuestionIcon(), null, null, null, null); } | promptUser |
277,862 | String (Editor editor) { return String.valueOf(getLineNumber(editor, editor.getSelectionModel().getSelectionEnd()) + 1); } | expand |
277,863 | String () { return "TempDir"; } | getName |
277,864 | String () { return IdeCoreBundle.message("macro.temp.dir"); } | getDescription |
277,865 | String (@NotNull DataContext dataContext) { if (SystemInfo.isWindows) { String tempDir = System.getenv("TEMP"); if (tempDir == null) { String homeDir = SystemProperties.getUserHome(); tempDir = homeDir + "\\AppData\\Local\\Temp"; } return tempDir; } return "/tmp"; } | expand |
277,866 | String () { return "FileRelativePath"; } | getName |
277,867 | String () { return IdeCoreBundle.message("macro.file.path.relative"); } | getDescription |
277,868 | String (@NotNull DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); final VirtualFile baseDir = project == null ? null : project.getBaseDir(); if (baseDir == null) { return null; } VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (file == null) return null; return FileUtil.getRelativePath(VfsUtil.virtualToIoFile(baseDir), VfsUtil.virtualToIoFile(file)); } | expand |
277,869 | String () { return "ContentRoot"; } | getName |
277,870 | String () { return IdeCoreBundle.message("macro.content.root"); } | getDescription |
277,871 | String (@NotNull final DataContext dataContext) { final Project project = CommonDataKeys.PROJECT.getData(dataContext); final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(dataContext); if (project == null || file == null) return null; final VirtualFile contentRoot = ProjectFileIndex.getInstance(project).getContentRootForFile(file); return contentRoot == null ? null : FileUtil.toSystemDependentName(contentRoot.getPath()); } | expand |
277,872 | void (ContentManager manager, Content content, boolean select) { final String contentName = content.getDisplayName(); Content[] contents = manager.getContents(); Content oldContentFound = null; for (Content oldContent : contents) { if (!oldContent.isPinned() && oldContent.getDisplayName().equals(contentName)) { oldContentFound = oldContent; break; } } manager.addContent(content); if (oldContentFound != null) { manager.removeContent(oldContentFound, true); } if (select) { manager.setSelectedContent(content); } } | addOrReplaceContent |
277,873 | void (final ContentManager manager, final Content content, final boolean select) { manager.addContent(content); if (select) { manager.setSelectedContent(content); } } | addContent |
277,874 | void (@NotNull ContentManager contentManager, @NotNull Content content) { if (content instanceof TabbedContent tabbedContent) { if (tabbedContent.hasMultipleTabs()) { JComponent component = tabbedContent.getComponent(); tabbedContent.removeContent(component); contentManager.setSelectedContent(tabbedContent, true, true); return; } } contentManager.removeContent(content, true); } | closeContentTab |
277,875 | T () { return getInstance(ApplicationManager.getApplication(), pluginDescriptor); } | getInstance |
277,876 | void (@NotNull PluginDescriptor pluginDescriptor) { this.pluginDescriptor = pluginDescriptor; } | setPluginDescriptor |
277,877 | void (@NotNull DataContext context, boolean requestFocus) { if (Registry.is("ide.navigation.requests")) { OpenSourceUtilKt.openSourcesFrom(context, requestFocus); return; } navigate(requestFocus, false, CommonDataKeys.NAVIGATABLE_ARRAY.getData(context)); } | openSourcesFrom |
277,878 | boolean (@Nullable Object object) { return object instanceof Navigatable && ((Navigatable)object).canNavigate(); } | canNavigate |
277,879 | boolean (@Nullable Object object) { return object instanceof Navigatable && ((Navigatable)object).canNavigateToSource(); } | canNavigateToSource |
277,880 | void (Navigatable @Nullable ... navigatables) { navigate(true, navigatables); } | navigate |
277,881 | void (boolean requestFocus, Navigatable @Nullable ... navigatables) { navigate(requestFocus, false, navigatables); } | navigate |
277,882 | void (boolean requestFocus, boolean tryNotToScroll, Navigatable @Nullable ... navigatables) { if (navigatables != null && navigatables.length > 0) { navigate(requestFocus, tryNotToScroll, List.of(navigatables)); } } | navigate |
277,883 | boolean (boolean requestFocus, boolean tryNotToScroll, @Nullable Iterable<? extends Navigatable> navigatables) { if (navigatables == null) { return false; } if (Registry.is("ide.navigation.requests")) { Project project = OpenSourceUtilKt.findProject(navigatables); if (project != null) { return OpenSourceUtilKt.navigate(project, requestFocus, tryNotToScroll, navigatables); } } Navigatable nonSourceNavigatable = null; int maxSourcesToNavigate = Registry.intValue("ide.source.file.navigation.limit", 100); int navigatedSourcesCounter = 0; for (Navigatable navigatable : navigatables) { if (maxSourcesToNavigate > 0 && navigatedSourcesCounter >= maxSourcesToNavigate) { break; } if (navigateToSource(requestFocus, tryNotToScroll, navigatable)) { navigatedSourcesCounter++; } else if (navigatedSourcesCounter == 0 && nonSourceNavigatable == null && navigatable != null && navigatable.canNavigate()) { nonSourceNavigatable = navigatable; } } if (navigatedSourcesCounter > 0) { return true; } if (nonSourceNavigatable == null) { return false; } nonSourceNavigatable.navigate(requestFocus); return true; } | navigate |
277,884 | boolean (boolean requestFocus, boolean tryNotToScroll, @Nullable Iterable<? extends Navigatable> navigatables) { if (navigatables == null) { return false; } boolean alreadyNavigatedToSource = false; for (Navigatable navigatable : navigatables) { if (navigateToSource(requestFocus, tryNotToScroll, navigatable)) { alreadyNavigatedToSource = true; } } return alreadyNavigatedToSource; } | navigateToSource |
277,885 | boolean (boolean requestFocus, boolean tryNotToScroll, @Nullable Navigatable navigatable) { if (navigatable == null) { return false; } if (Registry.is("ide.navigation.requests")) { Project project = OpenSourceUtilKt.findProject(navigatable); if (project != null) { return OpenSourceUtilKt.navigateToSource(project, requestFocus, tryNotToScroll, navigatable); } } if (!navigatable.canNavigateToSource()) { return false; } if (tryNotToScroll && navigatable instanceof StatePreservingNavigatable) { ((StatePreservingNavigatable)navigatable).navigate(requestFocus, true); } else { navigatable.navigate(requestFocus); } return true; } | navigateToSource |
277,886 | void (@NotNull JTree tree) { install((JComponent)tree); // backward compatibility } | install |
277,887 | void (@NotNull JComponent component) { install(component, null); } | install |
277,888 | void (@NotNull JComponent component, @Nullable Runnable whenPerformed) { onEnterKey(component, () -> { if (Registry.is("edit.source.on.enter.key.disabled") || isOverriddenByAction(IdeActions.ACTION_EDIT_SOURCE) || isOverriddenByAction(IdeActions.ACTION_VIEW_SOURCE)) { return false; } List<Navigatable> navigatables = getNavigatables(DataManager.getInstance().getDataContext(component)); // nowhere to navigate if (navigatables.isEmpty()) { return false; } boolean requestFocus = AdvancedSettings.getBoolean("edit.source.on.enter.key.request.focus.in.editor"); for (Navigatable navigatable : navigatables) { navigatable.navigate(requestFocus); } if (whenPerformed != null) { whenPerformed.run(); } return true; }); } | install |
277,889 | boolean (@NotNull String actionId) { KeymapManager manager = KeymapManager.getInstance(); return manager != null && null != ContainerUtil.find(manager.getActiveKeymap().getShortcuts(actionId), ENTER_SHORTCUT::equals); } | isOverriddenByAction |
277,890 | List<Navigatable> (@NotNull DataContext context) { Navigatable[] array = CommonDataKeys.NAVIGATABLE_ARRAY.getData(context); if (array == null || array.length == 0) { return Collections.emptyList(); } List<Navigatable> list = ContainerUtil.filter(array, Navigatable::canNavigateToSource); if (list.isEmpty() && Registry.is("edit.source.on.enter.key.non.source.navigation.enabled")) { for (Navigatable navigatable : array) { if (navigatable.canNavigate()) { // only one non-source navigatable should be supported // @see OpenSourceUtil#navigate(boolean, boolean, Iterable) return Collections.singletonList(navigatable); } } } return list; } | getNavigatables |
277,891 | void (@NotNull JComponent component, @NotNull BooleanSupplier action) { ActionListener listener = component.getActionForKeyStroke(ENTER); component.registerKeyboardAction(event -> { if (!action.getAsBoolean() && listener != null) { // perform previous action if the specified action is failed, // it is needed to expand/collapse a tree node listener.actionPerformed(event); } }, ENTER, JComponent.WHEN_FOCUSED); } | onEnterKey |
277,892 | Storage (AbstractProperty.AbstractPropertyContainer container) { Storage.MapStorage storage = new Storage.MapStorage(); set(container, storage); return storage; } | getDefault |
277,893 | Storage (Storage storage) { if (!(storage instanceof Storage.MapStorage)) { throw new UnsupportedOperationException(storage.getClass().getName()); } Iterator<String> keys = ((Storage.MapStorage)storage).getKeys(); Storage.MapStorage copy = new Storage.MapStorage(); while (keys.hasNext()) { String key = keys.next(); copy.put(key, storage.get(key)); } return copy; } | copy |
277,894 | String () { return myName; } | getName |
277,895 | boolean (@NotNull AnActionEvent e) { return !getProperty().get(getProperties()).booleanValue(); } | isSelected |
277,896 | void (@NotNull AnActionEvent e, boolean state) { getProperty().set(getProperties(), Boolean.valueOf(!state)); } | setSelected |
277,897 | String (Element dataElement) { return dataElement.getAttributeValue(VALUE_ATTRIBUTE); } | readValue |
277,898 | Integer (Element dataElement) { try { return Integer.valueOf(dataElement.getAttributeValue(VALUE_ATTRIBUTE)); } catch (NumberFormatException e) { return null; } } | readValue |
277,899 | void (Element dataElement, T value) { dataElement.setAttribute(VALUE_ATTRIBUTE, value.toString()); } | writeValue |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.