@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 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 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()); }
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 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); }
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); }
@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); } }