Search in sources :

Example 6 with UrlFilter

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

the class JBTabbedTerminalWidget method createInnerTerminalWidget.

@Override
protected JediTermWidget createInnerTerminalWidget(TabbedSettingsProvider settingsProvider) {
    JBTerminalWidget widget = new JBTerminalWidget(myProject, mySettingsProvider, myParent);
    widget.addMessageFilter(myProject, new UrlFilter());
    convertActions(widget, widget.getActions());
    convertActions(widget.getTerminalPanel(), widget.getTerminalPanel().getActions(), new Predicate<KeyEvent>() {

        @Override
        public boolean apply(KeyEvent input) {
            widget.getTerminalPanel().handleKeyEvent(input);
            return true;
        }
    });
    return widget;
}
Also used : UrlFilter(com.intellij.execution.filters.UrlFilter) JBTerminalWidget(com.intellij.terminal.JBTerminalWidget)

Example 7 with UrlFilter

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

the class PythonScriptCommandLineState method execute.

@Override
public ExecutionResult execute(Executor executor, PythonProcessStarter processStarter, final CommandLinePatcher... patchers) throws ExecutionException {
    if (myConfig.showCommandLineAfterwards() && !myConfig.emulateTerminal()) {
        if (executor.getId() == DefaultDebugExecutor.EXECUTOR_ID) {
            return super.execute(executor, processStarter, ArrayUtil.append(patchers, new CommandLinePatcher() {

                @Override
                public void patchCommandLine(GeneralCommandLine commandLine) {
                    commandLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_DEBUGGER).addParameterAt(1, "--cmd-line");
                }
            }));
        }
        PythonScriptWithConsoleRunner runner = new PythonScriptWithConsoleRunner(myConfig.getProject(), myConfig.getSdk(), PyConsoleType.PYTHON, myConfig.getWorkingDirectory(), myConfig.getEnvs(), patchers, PyConsoleOptions.getInstance(myConfig.getProject()).getPythonConsoleSettings());
        runner.setEnableAfterConnection(false);
        runner.runSync();
        // runner.getProcessHandler() would be null if execution error occurred
        if (runner.getProcessHandler() == null) {
            return null;
        }
        runner.getPydevConsoleCommunication().setConsoleView(runner.getConsoleView());
        List<AnAction> actions = Lists.newArrayList(createActions(runner.getConsoleView(), runner.getProcessHandler()));
        actions.add(new ShowVarsAction(runner.getConsoleView(), runner.getPydevConsoleCommunication()));
        return new DefaultExecutionResult(runner.getConsoleView(), runner.getProcessHandler(), actions.toArray(new AnAction[actions.size()]));
    } else if (myConfig.emulateTerminal()) {
        setRunWithPty(true);
        final ProcessHandler processHandler = startProcess(processStarter, patchers);
        TerminalExecutionConsole executeConsole = new TerminalExecutionConsole(myConfig.getProject(), processHandler);
        executeConsole.addMessageFilter(myConfig.getProject(), new PythonTracebackFilter(myConfig.getProject()));
        executeConsole.addMessageFilter(myConfig.getProject(), new UrlFilter());
        processHandler.startNotify();
        return new DefaultExecutionResult(executeConsole, processHandler, AnAction.EMPTY_ARRAY);
    } else {
        return super.execute(executor, processStarter, patchers);
    }
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ShowVarsAction(com.jetbrains.python.console.actions.ShowVarsAction) TerminalExecutionConsole(com.intellij.terminal.TerminalExecutionConsole) GeneralCommandLine(com.intellij.execution.configurations.GeneralCommandLine) OSProcessHandler(com.intellij.execution.process.OSProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) UrlFilter(com.intellij.execution.filters.UrlFilter) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 8 with UrlFilter

use of com.intellij.execution.filters.UrlFilter in project flutter-intellij by flutter.

the class DaemonConsoleView method install.

/**
 * Sets up a launcher to use a DaemonConsoleView.
 */
public static void install(@NotNull CommandLineState launcher, @NotNull ExecutionEnvironment env, @NotNull VirtualFile workDir) {
    // Create our own console builder.
    // We need to filter input to this console without affecting other consoles,
    // so we cannot use a consoleFilterInputProvider.
    final GlobalSearchScope searchScope = SearchScopeProvider.createSearchScope(env.getProject(), env.getRunProfile());
    final TextConsoleBuilder builder = new TextConsoleBuilderImpl(env.getProject(), searchScope) {

        @NotNull
        @Override
        protected ConsoleView createConsole() {
            return new DaemonConsoleView(env.getProject(), searchScope);
        }
    };
    // Set up basic console filters. (More may be added later.)
    builder.addFilter(new DartRelativePathsConsoleFilter(env.getProject(), workDir.getPath()));
    builder.addFilter(new UrlFilter());
    launcher.setConsoleBuilder(builder);
}
Also used : DartRelativePathsConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) UrlFilter(com.intellij.execution.filters.UrlFilter) TextConsoleBuilderImpl(com.intellij.execution.filters.TextConsoleBuilderImpl)

Example 9 with UrlFilter

use of com.intellij.execution.filters.UrlFilter in project flutter-intellij by flutter.

the class TestLaunchState method createConsole.

@Nullable
@Override
protected ConsoleView createConsole(@NotNull Executor executor) throws ExecutionException {
    if (!testConsoleEnabled) {
        return super.createConsole(executor);
    }
    // Create a console showing a test tree.
    final Project project = getEnvironment().getProject();
    final DartUrlResolver resolver = DartUrlResolver.getInstance(project, testFileOrDir);
    final ConsoleProps props = new ConsoleProps(config, executor, resolver);
    final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole("FlutterTestRunner", props);
    final Module module = ModuleUtil.findModuleForFile(testFileOrDir, project);
    if (module != null) {
        console.addMessageFilter(new FlutterConsoleFilter(module));
    }
    final String baseDir = getBaseDir();
    if (baseDir != null) {
        console.addMessageFilter(new DartRelativePathsConsoleFilter(project, baseDir));
    }
    console.addMessageFilter(new UrlFilter());
    return console;
}
Also used : DartRelativePathsConsoleFilter(com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter) Project(com.intellij.openapi.project.Project) FlutterConsoleFilter(io.flutter.console.FlutterConsoleFilter) DartUrlResolver(com.jetbrains.lang.dart.util.DartUrlResolver) UrlFilter(com.intellij.execution.filters.UrlFilter) BaseTestsOutputConsoleView(com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView) Module(com.intellij.openapi.module.Module) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

UrlFilter (com.intellij.execution.filters.UrlFilter)9 DartRelativePathsConsoleFilter (com.jetbrains.lang.dart.ide.runner.DartRelativePathsConsoleFilter)5 DartConsoleFilter (com.jetbrains.lang.dart.ide.runner.DartConsoleFilter)3 NotNull (org.jetbrains.annotations.NotNull)3 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)2 TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)2 Module (com.intellij.openapi.module.Module)2 Project (com.intellij.openapi.project.Project)2 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 ExecutionException (com.intellij.execution.ExecutionException)1 RunContentExecutor (com.intellij.execution.RunContentExecutor)1 RuntimeConfigurationError (com.intellij.execution.configurations.RuntimeConfigurationError)1 TextConsoleBuilderImpl (com.intellij.execution.filters.TextConsoleBuilderImpl)1 KillableColoredProcessHandler (com.intellij.execution.process.KillableColoredProcessHandler)1 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)1 ProcessHandler (com.intellij.execution.process.ProcessHandler)1 TestConsoleProperties (com.intellij.execution.testframework.TestConsoleProperties)1 SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)1 BaseTestsOutputConsoleView (com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1