Search in sources :

Example 1 with ConsoleView

use of com.intellij.execution.ui.ConsoleView in project buck by facebook.

the class TestExecutionState method execute.

@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    final ProcessHandler processHandler = runBuildCommand(executor);
    final TestConsoleProperties properties = new BuckTestConsoleProperties(processHandler, mProject, mConfiguration, "Buck test", executor);
    final ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("buck test", processHandler, properties);
    return new DefaultExecutionResult(console, processHandler, AnAction.EMPTY_ARRAY);
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ConsoleView(com.intellij.execution.ui.ConsoleView) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) TestConsoleProperties(com.intellij.execution.testframework.TestConsoleProperties) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with ConsoleView

use of com.intellij.execution.ui.ConsoleView in project intellij-elixir by KronicDeth.

the class MixExUnitRunningState method createAndAttachConsole.

/**
   * Unifies the interface for {@code SMTestRunnerConnectionUtil.createAndAttachConsole} between 141 and later releases
   */
private ConsoleView createAndAttachConsole(@NotNull String testFrameworkName, @NotNull ProcessHandler processHandler, @NotNull TestConsoleProperties consoleProperties) throws ExecutionException {
    Class<SMTestRunnerConnectionUtil> klass = SMTestRunnerConnectionUtil.class;
    ConsoleView consoleView = null;
    try {
        Method createAndAttachConsole = klass.getMethod("createAndAttachConsole", String.class, ProcessHandler.class, TestConsoleProperties.class);
        try {
            consoleView = (ConsoleView) createAndAttachConsole.invoke(null, testFrameworkName, processHandler, consoleProperties);
        } catch (IllegalAccessException | InvocationTargetException e) {
            LOGGER.error(e);
        }
    } catch (NoSuchMethodException noSuchCreateAndAttachConsole3Method) {
        try {
            Method createAndAttachConsole = klass.getMethod("createAndAttachConsole", String.class, ProcessHandler.class, TestConsoleProperties.class, ExecutionEnvironment.class);
            try {
                consoleView = (ConsoleView) createAndAttachConsole.invoke(null, testFrameworkName, processHandler, consoleProperties, getEnvironment());
            } catch (IllegalAccessException | InvocationTargetException e) {
                LOGGER.error(e);
            }
        } catch (NoSuchMethodException noSuchCreateAndAttachConsole4Method) {
            noSuchCreateAndAttachConsole4Method.printStackTrace();
        }
    }
    return consoleView;
}
Also used : ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) ConsoleView(com.intellij.execution.ui.ConsoleView) SMTestRunnerConnectionUtil(com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil) ProcessHandler(com.intellij.execution.process.ProcessHandler) Method(java.lang.reflect.Method) InvocationTargetException(java.lang.reflect.InvocationTargetException) TestConsoleProperties(com.intellij.execution.testframework.TestConsoleProperties)

Example 3 with ConsoleView

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

the class PythonTestCommandLineStateBase method execute.

@Override
public ExecutionResult execute(Executor executor, PythonProcessStarter processStarter, CommandLinePatcher... patchers) throws ExecutionException {
    final ProcessHandler processHandler = startProcess(processStarter, patchers);
    final ConsoleView console = createAndAttachConsole(myConfiguration.getProject(), processHandler, executor);
    DefaultExecutionResult executionResult = new DefaultExecutionResult(console, processHandler, createActions(console, processHandler));
    PyRerunFailedTestsAction rerunFailedTestsAction = new PyRerunFailedTestsAction(console);
    if (console instanceof SMTRunnerConsoleView) {
        rerunFailedTestsAction.init(((BaseTestsOutputConsoleView) console).getProperties());
        rerunFailedTestsAction.setModelProvider(() -> ((SMTRunnerConsoleView) console).getResultsViewer());
    }
    executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
    return executionResult;
}
Also used : SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) BaseTestsOutputConsoleView(com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) PythonDebugLanguageConsoleView(com.jetbrains.python.console.PythonDebugLanguageConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction)

Example 4 with ConsoleView

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

the class PythonCommandLineState method execute.

public ExecutionResult execute(Executor executor, PythonProcessStarter processStarter, CommandLinePatcher... patchers) throws ExecutionException {
    final ProcessHandler processHandler = startProcess(processStarter, patchers);
    final ConsoleView console = createAndAttachConsole(myConfig.getProject(), processHandler, executor);
    return new DefaultExecutionResult(console, processHandler, createActions(console, processHandler));
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler)

Example 5 with ConsoleView

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

the class RunContentExecutor method run.

public void run() {
    FileDocumentManager.getInstance().saveAllDocuments();
    // Use user-provided console if exist. Create new otherwise
    ConsoleView view = (myUserProvidedConsole != null ? myUserProvidedConsole : createConsole());
    view.attachToProcess(myProcess);
    if (myAfterCompletion != null) {
        myProcess.addProcessListener(new ProcessAdapter() {

            @Override
            public void processTerminated(ProcessEvent event) {
                ApplicationManager.getApplication().invokeLater(myAfterCompletion);
            }
        });
    }
    myProcess.startNotify();
}
Also used : ProcessAdapter(com.intellij.execution.process.ProcessAdapter) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessEvent(com.intellij.execution.process.ProcessEvent)

Aggregations

ConsoleView (com.intellij.execution.ui.ConsoleView)42 NotNull (org.jetbrains.annotations.NotNull)20 ProcessHandler (com.intellij.execution.process.ProcessHandler)15 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)9 SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)7 TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)6 Content (com.intellij.ui.content.Content)6 ConsoleViewImpl (com.intellij.execution.impl.ConsoleViewImpl)5 ToolWindow (com.intellij.openapi.wm.ToolWindow)5 Executor (com.intellij.execution.Executor)4 TestConsoleProperties (com.intellij.execution.testframework.TestConsoleProperties)4 ToggleAutoTestAction (com.intellij.execution.testframework.autotest.ToggleAutoTestAction)4 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)4 Disposable (com.intellij.openapi.Disposable)4 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)3 BaseTestsOutputConsoleView (com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView)3 CloseAction (com.intellij.execution.ui.actions.CloseAction)3 Project (com.intellij.openapi.project.Project)3 AndroidLogcatView (com.android.tools.idea.logcat.AndroidLogcatView)2 ExecutionException (com.intellij.execution.ExecutionException)2