Search in sources :

Example 6 with RunContentExecutor

use of com.intellij.execution.RunContentExecutor in project intellij-plugins by JetBrains.

the class SendToMayaCommand method run.

public void run() {
    try {
        final ProcessHandler process = createRunInMayaProcessHandler();
        new RunContentExecutor(myProject, process).withTitle(getTitle()).withRerun(() -> this.run()).withStop(() -> process.destroyProcess(), () -> !process.isProcessTerminated()).run();
    } catch (ExecutionException e) {
        Messages.showErrorDialog(myProject, e.getMessage(), getTitle());
    }
}
Also used : ProcessHandler(com.intellij.execution.process.ProcessHandler) RunContentExecutor(com.intellij.execution.RunContentExecutor) ExecutionException(com.intellij.execution.ExecutionException)

Example 7 with RunContentExecutor

use of com.intellij.execution.RunContentExecutor in project intellij-community by JetBrains.

the class PythonTask method run.

/**
   * @param env         environment variables to be passed to process or null if nothing should be passed
   * @param consoleView console to run this task on. New console will be used if no console provided.
   */
public void run(@Nullable final Map<String, String> env, @Nullable final ConsoleView consoleView) throws ExecutionException {
    final ProcessHandler process = createProcess(env);
    final Project project = myModule.getProject();
    new RunContentExecutor(project, process).withFilter(new PythonTracebackFilter(project)).withConsole(consoleView).withTitle(myRunTabTitle).withRerun(() -> {
        try {
            // Stop process before rerunning it
            process.destroyProcess();
            if (process.waitFor(TIME_TO_WAIT_PROCESS_STOP)) {
                this.run(env, consoleView);
            } else {
                Messages.showErrorDialog(PyBundle.message("unable.to.stop"), myRunTabTitle);
            }
        } catch (ExecutionException e) {
            Messages.showErrorDialog(e.getMessage(), myRunTabTitle);
        }
    }).withStop(() -> process.destroyProcess(), () -> !process.isProcessTerminated()).withAfterCompletion(myAfterCompletion).withHelpId(myHelpId).run();
}
Also used : Project(com.intellij.openapi.project.Project) ProcessHandler(com.intellij.execution.process.ProcessHandler) RunContentExecutor(com.intellij.execution.RunContentExecutor) ExecutionException(com.intellij.execution.ExecutionException)

Aggregations

RunContentExecutor (com.intellij.execution.RunContentExecutor)7 ExecutionException (com.intellij.execution.ExecutionException)6 ProcessHandler (com.intellij.execution.process.ProcessHandler)4 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)3 Project (com.intellij.openapi.project.Project)3 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)2 Module (com.intellij.openapi.module.Module)2 Sdk (com.intellij.openapi.projectRoots.Sdk)2 GoConsoleFilter (com.goide.runconfig.GoConsoleFilter)1 UrlFilter (com.intellij.execution.filters.UrlFilter)1 KillableColoredProcessHandler (com.intellij.execution.process.KillableColoredProcessHandler)1 ProcessListener (com.intellij.execution.process.ProcessListener)1 Key (com.intellij.openapi.util.Key)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 Task (com.jetbrains.edu.learning.courseFormat.Task)1 TaskFile (com.jetbrains.edu.learning.courseFormat.TaskFile)1 PyPackage (com.jetbrains.python.packaging.PyPackage)1 PythonTracebackFilter (com.jetbrains.python.run.PythonTracebackFilter)1 NonNls (org.jetbrains.annotations.NonNls)1 NotNull (org.jetbrains.annotations.NotNull)1