Search in sources :

Example 1 with DefaultProgramRunner

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

the class RemoteProcessSupport method startProcess.

private void startProcess(Target target, Parameters configuration, @NotNull Pair<Target, Parameters> key) {
    ProgramRunner runner = new DefaultProgramRunner() {

        @Override
        @NotNull
        public String getRunnerId() {
            return "MyRunner";
        }

        @Override
        public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
            return true;
        }
    };
    Executor executor = DefaultRunExecutor.getRunExecutorInstance();
    ProcessHandler processHandler;
    try {
        RunProfileState state = getRunProfileState(target, configuration, executor);
        ExecutionResult result = state.execute(executor, runner);
        //noinspection ConstantConditions
        processHandler = result.getProcessHandler();
    } catch (Exception e) {
        dropProcessInfo(key, e instanceof ExecutionException ? e.getMessage() : ExceptionUtil.getUserStackTrace(e, LOG), null);
        return;
    }
    processHandler.addProcessListener(getProcessListener(key));
    processHandler.startNotify();
}
Also used : DefaultRunExecutor(com.intellij.execution.executors.DefaultRunExecutor) Executor(com.intellij.execution.Executor) RunProfileState(com.intellij.execution.configurations.RunProfileState) DefaultProgramRunner(com.intellij.execution.runners.DefaultProgramRunner) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionResult(com.intellij.execution.ExecutionResult) RunProfile(com.intellij.execution.configurations.RunProfile) DefaultProgramRunner(com.intellij.execution.runners.DefaultProgramRunner) ProgramRunner(com.intellij.execution.runners.ProgramRunner) ExecutionException(com.intellij.execution.ExecutionException) NotNull(org.jetbrains.annotations.NotNull) ExecutionException(com.intellij.execution.ExecutionException)

Aggregations

ExecutionException (com.intellij.execution.ExecutionException)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 Executor (com.intellij.execution.Executor)1 RunProfile (com.intellij.execution.configurations.RunProfile)1 RunProfileState (com.intellij.execution.configurations.RunProfileState)1 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 DefaultProgramRunner (com.intellij.execution.runners.DefaultProgramRunner)1 ProgramRunner (com.intellij.execution.runners.ProgramRunner)1 NotNull (org.jetbrains.annotations.NotNull)1