Search in sources :

Example 16 with ExecutionResult

use of com.intellij.execution.ExecutionResult in project Intellij-Plugin by getgauge.

the class GaugeTestRunner method doExecute.

protected RunContentDescriptor doExecute(RunProfileState state, ExecutionEnvironment env) throws ExecutionException {
    FileDocumentManager.getInstance().saveAllDocuments();
    ExecutionResult executionResult = state.execute(env.getExecutor(), this);
    return executionResult == null ? null : new RunContentBuilder(executionResult, env).showRunContent(env.getContentToReuse());
}
Also used : ExecutionResult(com.intellij.execution.ExecutionResult) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder)

Example 17 with ExecutionResult

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

the class FlexRunner method standardLaunch.

@Nullable
private RunContentDescriptor standardLaunch(final Project project, final RunProfileState state, final RunContentDescriptor contentToReuse, final ExecutionEnvironment environment) throws ExecutionException {
    final ExecutionResult executionResult = state.execute(environment.getExecutor(), this);
    if (executionResult == null)
        return null;
    final RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, environment);
    return contentBuilder.showRunContent(contentToReuse);
}
Also used : ExecutionResult(com.intellij.execution.ExecutionResult) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder) Nullable(org.jetbrains.annotations.Nullable)

Example 18 with ExecutionResult

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

the class FlexRunner method launchAirFlexUnit.

@Nullable
protected RunContentDescriptor launchAirFlexUnit(final Project project, final RunProfileState state, final RunContentDescriptor contentToReuse, final ExecutionEnvironment env, final FlexUnitRunnerParameters params) throws ExecutionException {
    final ExecutionResult executionResult;
    final SwfPolicyFileConnection policyFileConnection = new SwfPolicyFileConnection();
    policyFileConnection.open(params.getSocketPolicyPort());
    final FlexUnitConnection flexUnitConnection = new FlexUnitConnection();
    flexUnitConnection.open(params.getPort());
    executionResult = state.execute(env.getExecutor(), this);
    if (executionResult == null) {
        flexUnitConnection.close();
        policyFileConnection.close();
        return null;
    }
    flexUnitConnection.addListener(new FlexUnitListener(executionResult.getProcessHandler()));
    executionResult.getProcessHandler().addProcessListener(new ProcessAdapter() {

        @Override
        public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
            flexUnitConnection.write("Finish");
        }

        @Override
        public void processTerminated(ProcessEvent event) {
            flexUnitConnection.close();
            policyFileConnection.close();
        }
    });
    final RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, env);
    return contentBuilder.showRunContent(contentToReuse);
}
Also used : SwfPolicyFileConnection(com.intellij.lang.javascript.flex.flexunit.SwfPolicyFileConnection) FlexUnitConnection(com.intellij.lang.javascript.flex.flexunit.FlexUnitConnection) ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ProcessEvent(com.intellij.execution.process.ProcessEvent) ExecutionResult(com.intellij.execution.ExecutionResult) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder) Nullable(org.jetbrains.annotations.Nullable)

Example 19 with ExecutionResult

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

the class DebugProcessImpl method attachVirtualMachine.

@Nullable
public ExecutionResult attachVirtualMachine(final DebugEnvironment environment, final DebuggerSession session) throws ExecutionException {
    mySession = session;
    myWaitFor.down();
    ApplicationManager.getApplication().assertIsDispatchThread();
    LOG.assertTrue(isInInitialState());
    myConnection = environment.getRemoteConnection();
    createVirtualMachine(environment);
    ExecutionResult executionResult;
    try {
        synchronized (myProcessListeners) {
            executionResult = environment.createExecutionResult();
            myExecutionResult = executionResult;
            if (executionResult == null) {
                fail();
                return null;
            }
            for (ProcessListener processListener : myProcessListeners) {
                executionResult.getProcessHandler().addProcessListener(processListener);
            }
            myProcessListeners.clear();
        }
    } catch (ExecutionException e) {
        fail();
        throw e;
    }
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return executionResult;
    }
    return executionResult;
}
Also used : ExecutionResult(com.intellij.execution.ExecutionResult) ExecutionException(com.intellij.execution.ExecutionException) Nullable(org.jetbrains.annotations.Nullable)

Example 20 with ExecutionResult

use of com.intellij.execution.ExecutionResult 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

ExecutionResult (com.intellij.execution.ExecutionResult)25 Nullable (org.jetbrains.annotations.Nullable)10 NotNull (org.jetbrains.annotations.NotNull)9 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)6 RunContentBuilder (com.intellij.execution.runners.RunContentBuilder)6 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)6 ProcessHandler (com.intellij.execution.process.ProcessHandler)5 XDebugProcessStarter (com.intellij.xdebugger.XDebugProcessStarter)5 XDebugSession (com.intellij.xdebugger.XDebugSession)5 ExecutionException (com.intellij.execution.ExecutionException)4 Project (com.intellij.openapi.project.Project)3 XDebugProcess (com.intellij.xdebugger.XDebugProcess)3 DartUrlResolver (com.jetbrains.lang.dart.util.DartUrlResolver)3 JstdBrowserInfo (com.google.jstestdriver.idea.server.JstdBrowserInfo)2 JstdServerLifeCycleAdapter (com.google.jstestdriver.idea.server.JstdServerLifeCycleAdapter)2 DebugEnvironment (com.intellij.debugger.DebugEnvironment)2 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)2 RunProfile (com.intellij.execution.configurations.RunProfile)2 NopProcessHandler (com.intellij.execution.process.NopProcessHandler)2 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)2