@Override public void update(AnActionEvent e) { Presentation presentation = e.getPresentation(); IdeaPluginDescriptor[] selection = getPluginTable().getSelectedObjects(); boolean enabled = (selection != null); if (enabled) { for (IdeaPluginDescriptor descr : selection) { presentation.setText(IdeBundle.message("action.download.and.install.plugin")); presentation.setDescription(IdeBundle.message("action.download.and.install.plugin")); enabled &= !ourInstallingNodes.contains(descr); if (descr instanceof PluginNode) { enabled &= !PluginManagerColumnInfo.isDownloaded((PluginNode) descr); if (((PluginNode) descr).getStatus() == PluginNode.STATUS_INSTALLED) { presentation.setText(IdeBundle.message("action.update.plugin")); presentation.setDescription(IdeBundle.message("action.update.plugin")); enabled &= ourState.hasNewerVersion(descr.getPluginId()); } } else if (descr instanceof IdeaPluginDescriptorImpl) { presentation.setText(IdeBundle.message("action.update.plugin")); presentation.setDescription(IdeBundle.message("action.update.plugin")); PluginId id = descr.getPluginId(); enabled = enabled && ourState.hasNewerVersion(id); } } } presentation.setEnabled(enabled); }
@Override public void update(@NotNull AnActionEvent e) { super.update(e); Presentation presentation = e.getPresentation(); DataContext context = e.getDataContext(); EditorWindow window = getEditorWindow(context); if (window == null || window.getOwner().isPreview()) { presentation.setEnabledAndVisible(false); } else { if (getFile(context) != null) { presentation.setEnabledAndVisible(true); } else { Content content = getContent(context); presentation.setEnabledAndVisible(content != null && content.isPinnable()); } } if (ActionPlaces.EDITOR_TAB_POPUP.equals(e.getPlace()) || ViewContext.CELL_POPUP_PLACE.equals(e.getPlace())) { presentation.setText( isSelected(e) ? IdeBundle.message("action.unpin.tab") : IdeBundle.message("action.pin.tab")); } else { presentation.setText( isSelected(e) ? IdeBundle.message("action.unpin.active.tab") : IdeBundle.message("action.pin.active.tab")); } }
@Override public void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); if (myFocusDrawer == null) { presentation.setText("Start Focus Debugger"); } else { presentation.setText("Stop Focus Debugger"); } }
@Override public void update(@NotNull final AnActionEvent e) { super.update(e); final Presentation presentation = e.getPresentation(); DebugProcessImpl process = getCurrentDebugProcess(e.getProject()); if (process == null || process.canGetMethodReturnValue()) { presentation.setEnabled(true); presentation.setText(myText); } else { presentation.setEnabled(false); presentation.setText(myTextUnavailable); } }
@Override public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = event.getData(CommonDataKeys.PROJECT); presentation.setEnabled(project != null); if (ProjectAttachProcessor.canAttachToProject() && project != null && ModuleManager.getInstance(project).getModules().length > 1) { presentation.setText("Close Pro_jects in Current Window"); } else { presentation.setText("Close Pro_ject"); } }
@Override public void update(@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); OpenInBrowserRequest result = BaseOpenInBrowserAction.doUpdate(e); if (result == null) { return; } String description = getTemplatePresentation().getDescription(); if (HtmlUtil.isHtmlFile(result.getFile())) { description += " (hold Shift to open URL of local file)"; } presentation.setText(getTemplatePresentation().getText()); presentation.setDescription(description); WebBrowser browser = findUsingBrowser(); if (browser != null) { presentation.setIcon(browser.getIcon()); } if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(presentation.isEnabled()); } }
@Override public void update(final AnActionEvent event) { if (event.getProject() == null || event.getData(EditorGutter.KEY) != null || Boolean.TRUE.equals(event.getData(CommonDataKeys.EDITOR_VIRTUAL_SPACE))) { event.getPresentation().setEnabled(false); return; } for (GotoDeclarationHandler handler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) { try { String text = handler.getActionText(event.getDataContext()); if (text != null) { Presentation presentation = event.getPresentation(); presentation.setText(text); break; } } catch (AbstractMethodError e) { LOG.error(handler.toString(), e); } } super.update(event); }
@Override public final void update(final AnActionEvent event) { final Presentation presentation = event.getPresentation(); final DataContext dataContext = event.getDataContext(); final HierarchyBrowserBaseEx browser = (HierarchyBrowserBaseEx) dataContext.getData(myBrowserDataKey); if (browser == null) { presentation.setVisible(false); presentation.setEnabled(false); return; } presentation.setVisible(true); final PsiElement selectedElement = browser.getSelectedElement(); if (selectedElement == null || !browser.isApplicableElement(selectedElement)) { presentation.setEnabled(false); presentation.setVisible(false); return; } presentation.setEnabled(isEnabled(browser, selectedElement)); String nonDefaultText = getNonDefaultText(browser, selectedElement); if (nonDefaultText != null) { presentation.setText(nonDefaultText); } }
@Override public void update(AnActionEvent e) { Presentation presentation = e.getPresentation(); if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace()) || ActionPlaces.COMMANDER_POPUP.equals(e.getPlace())) { presentation.setText(IdeBundle.message("action.delete.ellipsis")); } else { presentation.setText(IdeBundle.message("action.delete")); } if (e.getProject() == null) { presentation.setEnabled(false); return; } DataContext dataContext = e.getDataContext(); DeleteProvider provider = getDeleteProvider(dataContext); if (e.getInputEvent() instanceof KeyEvent) { KeyEvent keyEvent = (KeyEvent) e.getInputEvent(); Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext); if (component instanceof JTextComponent) provider = null; // Do not override text deletion if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) { // Do not override text deletion in speed search if (component instanceof JComponent) { SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent) component); if (searchSupply != null) provider = null; } String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext); if (!StringUtil.isEmpty(activeSpeedSearchFilter)) { provider = null; } } } if (provider instanceof TitledHandler) { presentation.setText(((TitledHandler) provider).getActionTitle()); } boolean canDelete = provider != null && provider.canDeleteElement(dataContext); if (ActionPlaces.isPopupPlace(e.getPlace())) { presentation.setVisible(canDelete); } else { presentation.setEnabled(canDelete); } }
@Override public final void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final Project project = e.getProject(); if (project == null) return; presentation.setEnabled(isEnabled()); presentation.setText(getCurrentScopeType()); }
@Override public void update(final AnActionEvent e) { super.update(e); final Presentation presentation = e.getPresentation(); presentation.setIcon(SvnIcons.ShowIntegratedFrom); presentation.setText(SvnBundle.message("committed.changes.action.enable.merge.highlighting")); presentation.setDescription( SvnBundle.message("committed.changes.action.enable.merge.highlighting.description.text")); }
public ExternalSystemTaskAction(Project project, String group, TaskData taskData) { myGroup = group; myTaskData = taskData; myId = getActionPrefix(project, taskData.getLinkedExternalProjectPath()) + taskData.getName(); Presentation template = getTemplatePresentation(); template.setText(myTaskData.getName() + " (" + group + ")", false); template.setIcon(ExternalSystemIcons.Task); }
@Override public void update(AnActionEvent event) { super.update(event); if (event.getPresentation().isEnabled()) { Presentation presentation = event.getPresentation(); String url = getIssueUrl(event); presentation.setEnabled(url != null); Project project = getProject(event); if (project == null || !TaskManager.getManager(project).getActiveTask().isIssue()) { presentation.setText(getTemplatePresentation().getText()); } else { presentation.setText( "Open '" + TaskManager.getManager(project).getActiveTask().getPresentableName() + "' In _Browser"); } } }
public ToggleSourcesStateAction( JTree tree, ContentEntryTreeEditor entryEditor, boolean editTestSources) { super(tree); myEntryTreeEditor = entryEditor; myEditTestSources = editTestSources; final Presentation templatePresentation = getTemplatePresentation(); if (editTestSources) { templatePresentation.setText(ProjectBundle.message("module.toggle.test.sources.action")); templatePresentation.setDescription( ProjectBundle.message("module.toggle.test.sources.action.description")); templatePresentation.setIcon(IconSet.TEST_ROOT_FOLDER); } else { templatePresentation.setText(ProjectBundle.message("module.toggle.sources.action")); templatePresentation.setDescription( ProjectBundle.message("module.toggle.sources.action.description")); templatePresentation.setIcon(IconSet.SOURCE_ROOT_FOLDER); } }
@Override public void update(final AnActionEvent e) { super.update(e); final Presentation presentation = e.getPresentation(); presentation.setText( ProjectBundle.message( myEditTestSources ? "module.toggle.test.sources.action" : "module.toggle.sources.action")); }
@Override public void update(final AnActionEvent event) { final Presentation presentation = event.getPresentation(); String name = myEnvironment.getRunProfile().getName(); ProcessHandler processHandler = myDescriptor.getProcessHandler(); final boolean isRunning = processHandler != null && !processHandler.isProcessTerminated(); presentation.setText(ExecutionBundle.message("rerun.configuration.action.name", name)); presentation.setIcon(isRunning ? AllIcons.Actions.Restart : myExecutor.getIcon()); presentation.setEnabled(isEnabled()); }
public AddNewRootAction( @NotNull SModel model, @NotNull SConcept concept, @Nullable Setter<SNode> newRootCallback) { myModel = model; myConcept = concept; myNewRootCallback = newRootCallback; setExecuteOutsideCommand(false); final Presentation tp = getTemplatePresentation(); tp.setText( concept.getConceptAlias().isEmpty() ? concept.getName() : concept.getConceptAlias()); tp.setIcon(IconManager.getIcon(concept)); }
@Override public void update(AnActionEvent e) { Presentation presentation = e.getPresentation(); String filePath = getActionFile(e); if (filePath == null) { presentation.setVisible(false); } else { File f = new File(filePath); presentation.setVisible(true); presentation.setText(String.format("Load \"%s\" in Haskell REPL", f.getName())); } }
private static void updatePresentation( @Nullable ExecutionTarget target, @Nullable RunnerAndConfigurationSettings settings, @Nullable Project project, @NotNull Presentation presentation) { if (project != null && target != null && settings != null) { String name = settings.getName(); if (target != DefaultExecutionTarget.INSTANCE) { name += " | " + target.getDisplayName(); } else { if (!settings.canRunOn(target)) { name += " | Nothing to run on"; } } presentation.setText(name, false); setConfigurationIcon(presentation, settings, project); } else { presentation.setText(""); // IDEA-21657 presentation.setIcon(null); } }
public ReopenProjectAction( final String projectPath, final String projectName, final String displayName) { myProjectPath = projectPath; myProjectName = projectName; final Presentation presentation = getTemplatePresentation(); String text = projectPath.equals(displayName) ? FileUtil.getLocationRelativeToUserHome(projectPath) : displayName; presentation.setText(text, false); presentation.setDescription(projectPath); }
public SelectTargetAction( final Project project, final ExecutionTarget target, boolean selected) { myProject = project; myTarget = target; String name = target.getDisplayName(); Presentation presentation = getTemplatePresentation(); presentation.setText(name, false); presentation.setDescription("Select " + name); presentation.setIcon(selected ? CHECKED_ICON : EMPTY_ICON); presentation.setSelectedIcon(selected ? CHECKED_SELECTED_ICON : EMPTY_ICON); }
@Override public void update(@NotNull AnActionEvent e) { Presentation presentation = e.getPresentation(); Project project = e.getProject(); presentation.setEnabledAndVisible(project != null && CCUtils.isCourseCreator(project)); if (project != null) { final Course course = StudyTaskManager.getInstance(project).getCourse(); if (course != null) { final int id = course.getId(); if (id > 0) { presentation.setText("Update Course on Stepik"); } } } }
public SelectConfigAction( final RunnerAndConfigurationSettings configuration, final Project project) { myConfiguration = configuration; myProject = project; String name = configuration.getName(); if (name == null || name.length() == 0) { name = " "; } final Presentation presentation = getTemplatePresentation(); presentation.setText(name, false); final ConfigurationType type = configuration.getType(); if (type != null) { presentation.setDescription( "Select " + type.getConfigurationTypeDescription() + " '" + name + "'"); } updateIcon(presentation); }
public ExternalSystemRunConfigurationAction( Project project, RunnerAndConfigurationSettings configurationSettings) { myConfigurationSettings = configurationSettings; ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration) configurationSettings.getConfiguration(); systemId = runConfiguration.getSettings().getExternalSystemId(); ExternalSystemUiAware uiAware = ExternalSystemUiUtil.getUiAware(systemId); myGroup = uiAware.getProjectRepresentationName( runConfiguration.getSettings().getExternalProjectPath(), null); String actionIdPrefix = getActionPrefix(project, runConfiguration.getSettings().getExternalProjectPath()); myId = actionIdPrefix + configurationSettings.getName(); Presentation template = getTemplatePresentation(); template.setText(myConfigurationSettings.getName(), false); template.setIcon(runConfiguration.getIcon()); }
@Override public void update(final AnActionEvent e) { final Presentation presentation = e.getPresentation(); final Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) { disable(presentation); return; } RunnerAndConfigurationSettings settings = chooseTempSettings(project); if (settings == null) { disable(presentation); } else { presentation.setText( ExecutionBundle.message( "save.temporary.run.configuration.action.name", settings.getName())); presentation.setDescription(presentation.getText()); presentation.setVisible(true); presentation.setEnabled(true); } }
public void update(AnActionEvent e) { DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext()); boolean visible = false; boolean enabled = false; String text = DebuggerBundle.message("action.resume.thread.text.resume"); if (selectedNodes != null && selectedNodes.length > 0) { visible = true; enabled = true; for (DebuggerTreeNodeImpl selectedNode : selectedNodes) { final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor(); if (!(threadDescriptor instanceof ThreadDescriptorImpl) || !((ThreadDescriptorImpl) threadDescriptor).isSuspended()) { visible = false; break; } } } final Presentation presentation = e.getPresentation(); presentation.setText(text); presentation.setVisible(visible); presentation.setEnabled(enabled); }
protected void updateText(final Presentation presentation, final String actionText) { presentation.setText( ExecutionBundle.message("create.run.configuration.for.item.action.name", actionText) + "...", false); }
protected void updateText(final Presentation presentation, final String actionText) { presentation.setText(generateName(actionText), false); }