ActionWrapper[] (final @NotNull Project project, final ChooseRunConfigurationPopup action, final @NotNull RunnerAndConfigurationSettings settings, final boolean dynamic) { final List<ActionWrapper> result = new ArrayList<>(); final ExecutionTarget active = ExecutionTargetManager.getActiveTarget(project); for (final ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, settings.getConfiguration())) { result.add(new ActionWrapper(eachTarget.getDisplayName(), eachTarget.getIcon()) { { setChecked(eachTarget.equals(active)); } @Override public void perform() { final RunManager manager = RunManager.getInstance(project); if (dynamic) { manager.setTemporaryConfiguration(settings); } manager.setSelectedConfiguration(settings); ExecutionTargetManager.setActiveTarget(project, eachTarget); ExecutionUtil.runConfiguration(settings, action.getExecutor()); } }); } boolean isFirst = true; final List<Executor> allExecutors = new ArrayList<>(); for (Executor executor: Executor.EXECUTOR_EXTENSION_NAME.getExtensionList()) { if (executor instanceof ExecutorGroup) { allExecutors.addAll(((ExecutorGroup<?>)executor).childExecutors()); } else { allExecutors.add(executor); } } for (final Executor executor : allExecutors) { if (ExecutorRegistryImpl.RunnerHelper.canRun(project, executor, settings.getConfiguration())) { result.add(new ActionWrapper(executor.getActionName(), executor.getIcon(), isFirst) { @Override public void perform() { final RunManager manager = RunManager.getInstance(project); if (dynamic) { manager.setTemporaryConfiguration(settings); } if (!manager.isRiderRunWidgetActive()) manager.setSelectedConfiguration(settings); ExecutorRegistryImpl.RunnerHelper.run(project, settings.getConfiguration(), settings, DataContext.EMPTY_CONTEXT, executor); } }); isFirst = false; } } result.add(new ActionWrapper(ExecutionBundle.message("choose.run.popup.edit"), AllIcons.Actions.EditSource, true) { @Override public void perform() { if (dynamic) { RunManager.getInstance(project).setTemporaryConfiguration(settings); } action.editConfiguration(project, settings); } }); if (settings.isTemporary() || dynamic) { result.add(new ActionWrapper(ExecutionBundle.message("choose.run.popup.save"), AllIcons.Actions.MenuSaveall) { @Override public void perform() { final RunManager manager = RunManager.getInstance(project); if (dynamic) { manager.setTemporaryConfiguration(settings); } manager.makeStable(settings); } }); } result.add(new ActionWrapper(ExecutionBundle.message("choose.run.popup.delete"), AllIcons.Actions.Cancel) { @Override public void perform() { deleteConfiguration(project, settings, action.myPopup); } }); return result.toArray(new ActionWrapper[0]); }