public static void runConfiguration( @NotNull RunnerAndConfigurationSettings configuration, @NotNull Executor executor) { ExecutionEnvironmentBuilder builder = createEnvironment(executor, configuration); if (builder != null) { ExecutionManager.getInstance(configuration.getConfiguration().getProject()) .restartRunProfile(builder.activeTarget().build()); } }
@Override public void actionPerformed(final AnActionEvent e) { Project project = myEnvironment.getProject(); if (project == null) return; if (myProcessHandler != null) { ExecutionManager.getInstance(project) .restartRunProfile( project, myExecutor, myEnvironment.getExecutionTarget(), myEnvironment.getRunnerAndConfigurationSettings(), myProcessHandler); } else { ExecutionManager.getInstance(project) .restartRunProfile( project, myExecutor, myEnvironment.getExecutionTarget(), myEnvironment.getRunnerAndConfigurationSettings(), myDescriptor); } }
protected void showConsole(Executor defaultExecutor, RunContentDescriptor myDescriptor) { // Show in run toolwindow ExecutionManager.getInstance(myProject) .getContentManager() .showRunContent(defaultExecutor, myDescriptor); // Request focus final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(defaultExecutor.getId()); window.activate( new Runnable() { public void run() { IdeFocusManager.getInstance(myProject) .requestFocus(getLanguageConsole().getCurrentEditor().getContentComponent(), true); } }); }
private static boolean askForClosingDebugSessions(@NotNull Project project) { final List<Pair<ProcessHandler, RunContentDescriptor>> pairs = new ArrayList<Pair<ProcessHandler, RunContentDescriptor>>(); for (Project p : ProjectManager.getInstance().getOpenProjects()) { final ProcessHandler[] processes = ExecutionManager.getInstance(p).getRunningProcesses(); for (ProcessHandler process : processes) { if (!process.isProcessTerminated()) { final AndroidSessionInfo info = process.getUserData(AndroidDebugRunner.ANDROID_SESSION_INFO); if (info != null) { pairs.add(Pair.create(process, info.getDescriptor())); } } } } if (pairs.size() == 0) { return true; } final StringBuilder s = new StringBuilder(); for (Pair<ProcessHandler, RunContentDescriptor> pair : pairs) { if (s.length() > 0) { s.append('\n'); } s.append(pair.getSecond().getDisplayName()); } final int r = Messages.showYesNoDialog( project, AndroidBundle.message("android.debug.sessions.will.be.closed", s), AndroidBundle.message("android.disable.adb.service.title"), Messages.getQuestionIcon()); return r == Messages.YES; }
public static void restart(@NotNull ExecutionEnvironment environment) { if (!ExecutorRegistry.getInstance().isStarting(environment)) { ExecutionManager.getInstance(environment.getProject()).restartRunProfile(environment); } }