Search in sources :

Example 1 with GoConsoleFilter

use of com.goide.runconfig.GoConsoleFilter in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoExecutor method showOutput.

private void showOutput(@NotNull OSProcessHandler originalHandler, @NotNull GoHistoryProcessListener historyProcessListener) {
    if (myShowOutputOnError) {
        BaseOSProcessHandler outputHandler = new KillableColoredProcessHandler(originalHandler.getProcess(), null);
        RunContentExecutor runContentExecutor = new RunContentExecutor(myProject, outputHandler).withTitle(getPresentableName()).withActivateToolWindow(myShowOutputOnError).withFilter(new GoConsoleFilter(myProject, myModule, myWorkDirectory != null ? VfsUtilCore.pathToUrl(myWorkDirectory) : null));
        Disposer.register(myProject, runContentExecutor);
        runContentExecutor.run();
        historyProcessListener.apply(outputHandler);
    }
    if (myShowNotificationsOnError) {
        showNotification("Failed to run", NotificationType.ERROR);
    }
}
Also used : GoConsoleFilter(com.goide.runconfig.GoConsoleFilter) RunContentExecutor(com.intellij.execution.RunContentExecutor)

Example 2 with GoConsoleFilter

use of com.goide.runconfig.GoConsoleFilter in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoTestRunningState method execute.

@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    ProcessHandler processHandler = startProcess();
    TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(myConfiguration.getProject());
    setConsoleBuilder(consoleBuilder);
    GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(myConfiguration, executor);
    String frameworkName = myConfiguration.getTestFramework().getName();
    ConsoleView consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole(frameworkName, processHandler, consoleProperties);
    consoleView.addMessageFilter(new GoConsoleFilter(myConfiguration.getProject(), myModule, myConfiguration.getWorkingDirectoryUrl()));
    ProcessTerminatedListener.attach(processHandler);
    DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler);
    AbstractRerunFailedTestsAction rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(consoleView);
    if (rerunFailedTestsAction != null) {
        rerunFailedTestsAction.setModelProvider(((SMTRunnerConsoleView) consoleView)::getResultsViewer);
        executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
    } else {
        executionResult.setRestartActions(new ToggleAutoTestAction());
    }
    return executionResult;
}
Also used : GoConsoleFilter(com.goide.runconfig.GoConsoleFilter) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

GoConsoleFilter (com.goide.runconfig.GoConsoleFilter)2 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 RunContentExecutor (com.intellij.execution.RunContentExecutor)1 TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 AbstractRerunFailedTestsAction (com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction)1 ToggleAutoTestAction (com.intellij.execution.testframework.autotest.ToggleAutoTestAction)1 SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 NotNull (org.jetbrains.annotations.NotNull)1