@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 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); }
private static void setConfigurationIcon( final Presentation presentation, final RunnerAndConfigurationSettings settings, final Project project) { try { presentation.setIcon(RunManagerEx.getInstanceEx(project).getConfigurationIcon(settings)); } catch (IndexNotReadyException ignored) { } }
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); } }
@Override public void update(AnActionEvent e) { Presentation presentation = e.getPresentation(); Project project = e.getData(CommonDataKeys.PROJECT); if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace())) { presentation.setDescription( ExecutionBundle.message("choose.run.configuration.action.description")); } try { if (project == null || project.isDisposed() || !project.isInitialized()) { updatePresentation(null, null, null, presentation); presentation.setEnabled(false); } else { updatePresentation( ExecutionTargetManager.getActiveTarget(project), RunManagerEx.getInstanceEx(project).getSelectedConfiguration(), project, presentation); presentation.setEnabled(true); } } catch (IndexNotReadyException e1) { presentation.setEnabled(false); } }
@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); } }
private static void disable(final Presentation presentation) { presentation.setEnabled(false); presentation.setVisible(false); }
public SaveTemporaryAction() { Presentation presentation = getTemplatePresentation(); presentation.setIcon(AllIcons.Actions.Menu_saveall); }