Search in sources :

Example 6 with TextConsoleBuilder

use of com.intellij.execution.filters.TextConsoleBuilder in project android by JetBrains.

the class AndroidRunConfiguration method getConsoleProvider.

@NotNull
@Override
protected ConsoleProvider getConsoleProvider() {
    return new ConsoleProvider() {

        @NotNull
        @Override
        public ConsoleView createAndAttach(@NotNull Disposable parent, @NotNull ProcessHandler handler, @NotNull Executor executor) throws ExecutionException {
            Project project = getConfigurationModule().getProject();
            final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
            ConsoleView console = builder.getConsole();
            console.attachToProcess(handler);
            return console;
        }
    };
}
Also used : Disposable(com.intellij.openapi.Disposable) Project(com.intellij.openapi.project.Project) Executor(com.intellij.execution.Executor) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) NotNull(org.jetbrains.annotations.NotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with TextConsoleBuilder

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

the class DebuggerUtilsEx method addThreadDump.

public static void addThreadDump(Project project, List<ThreadState> threads, final RunnerLayoutUi ui, DebuggerSession session) {
    final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
    consoleBuilder.filters(ExceptionFilters.getFilters(session.getSearchScope()));
    final ConsoleView consoleView = consoleBuilder.getConsole();
    final DefaultActionGroup toolbarActions = new DefaultActionGroup();
    consoleView.allowHeavyFilters();
    final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
    final String id = THREAD_DUMP_CONTENT_PREFIX + " #" + myCurrentThreadDumpId;
    final Content content = ui.createContent(id, panel, id, null, null);
    content.putUserData(RunnerContentUi.LIGHTWEIGHT_CONTENT_MARKER, Boolean.TRUE);
    content.setCloseable(true);
    content.setDescription("Thread Dump");
    ui.addContent(content);
    ui.selectAndFocus(content, true, true);
    myThreadDumpsCount++;
    myCurrentThreadDumpId++;
    Disposer.register(content, new Disposable() {

        @Override
        public void dispose() {
            myThreadDumpsCount--;
            if (myThreadDumpsCount == 0) {
                myCurrentThreadDumpId = 1;
            }
        }
    });
    Disposer.register(content, consoleView);
    ui.selectAndFocus(content, true, false);
    if (threads.size() > 0) {
        panel.selectStackFrame(0);
    }
}
Also used : Disposable(com.intellij.openapi.Disposable) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ConsoleView(com.intellij.execution.ui.ConsoleView) Content(com.intellij.ui.content.Content) ThreadDumpPanel(com.intellij.unscramble.ThreadDumpPanel) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup)

Example 8 with TextConsoleBuilder

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

the class MavenConsoleImpl method createConsoleBuilder.

public static TextConsoleBuilder createConsoleBuilder(final Project project) {
    TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
    builder.addFilter(new RegexpFilter(project, CONSOLE_FILTER_REGEXP) {

        @Nullable
        @Override
        protected HyperlinkInfo createOpenFileHyperlink(String fileName, int line, int column) {
            HyperlinkInfo res = super.createOpenFileHyperlink(fileName, line, column);
            if (res == null && fileName.startsWith("\\") && SystemInfo.isWindows) {
                // Maven cut prefix 'C:\' from paths on Windows
                VirtualFile[] roots = ProjectRootManager.getInstance(project).getContentRoots();
                if (roots.length > 0) {
                    String projectPath = roots[0].getPath();
                    if (projectPath.matches("[A-Z]:[\\\\/].+")) {
                        res = super.createOpenFileHyperlink(projectPath.charAt(0) + ":" + fileName, line, column);
                    }
                }
            }
            return res;
        }
    });
    builder.addFilter(new MavenGroovyConsoleFilter(project));
    builder.addFilter(new MavenScalaConsoleFilter(project));
    builder.addFilter(new MavenTestConsoleFilter());
    return builder;
}
Also used : RegexpFilter(com.intellij.execution.filters.RegexpFilter) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) Nullable(org.jetbrains.annotations.Nullable) HyperlinkInfo(com.intellij.execution.filters.HyperlinkInfo)

Example 9 with TextConsoleBuilder

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

the class XsltRunConfiguration method getState.

@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws ExecutionException {
    if (myXsltFile == null)
        throw new ExecutionException("No XSLT file selected");
    final VirtualFile baseFile = myXsltFile.getFile();
    final XsltCommandLineState state = new XsltCommandLineState(this, executionEnvironment);
    final TextConsoleBuilder builder = TextConsoleBuilderFactory.getInstance().createBuilder(getProject());
    builder.addFilter(new CustomRegexpFilter(getProject(), RegexpFilter.FILE_PATH_MACROS + "\\:" + "(?:(?: line )?" + RegexpFilter.LINE_MACROS + ")?" + "(?:\\:(?: column )?" + RegexpFilter.COLUMN_MACROS + ")?", baseFile, STRICT_FILE_PATH_EXPR));
    builder.addFilter(new CustomRegexpFilter(getProject(), LOG_TAG + RegexpFilter.FILE_PATH_MACROS + "\\:" + "(?:(?: line )?" + RegexpFilter.LINE_MACROS + ")?" + "(?:\\:(?: column )?" + RegexpFilter.COLUMN_MACROS + ")?", baseFile, RELAXED_FILE_PATH_EXPR));
    builder.addFilter(new CustomRegexpFilter(getProject(), RegexpFilter.FILE_PATH_MACROS + ";" + " \\w+ #" + RegexpFilter.LINE_MACROS + "(?:; \\w+ #" + RegexpFilter.COLUMN_MACROS + ")?", baseFile, STRICT_FILE_PATH_EXPR));
    builder.addFilter(new CustomRegexpFilter(getProject(), LOG_TAG + RegexpFilter.FILE_PATH_MACROS + ";" + " \\w+ #" + RegexpFilter.LINE_MACROS + "(?:; \\w+ #" + RegexpFilter.COLUMN_MACROS + ")?", baseFile, RELAXED_FILE_PATH_EXPR));
    builder.addFilter(new CustomRegexpFilter(getProject(), "(?:" + RegexpFilter.FILE_PATH_MACROS + ")?" + " line " + RegexpFilter.LINE_MACROS + "(?:\\:(?: column )?" + RegexpFilter.COLUMN_MACROS + ")?", baseFile, STRICT_FILE_PATH_EXPR));
    state.setConsoleBuilder(builder);
    return state;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ExecutionException(com.intellij.execution.ExecutionException)

Example 10 with TextConsoleBuilder

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

the class ConsoleManager method createConsole.

private void createConsole(@NotNull final NetService netService) {
    TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject());
    netService.configureConsole(consoleBuilder);
    console = consoleBuilder.getConsole();
    ApplicationManager.getApplication().invokeLater(() -> {
        ActionGroup actionGroup = netService.getConsoleToolWindowActions();
        ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);
        SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
        toolWindowPanel.setContent(console.getComponent());
        toolWindowPanel.setToolbar(toolbar.getComponent());
        ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject()).registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true);
        toolWindow.setIcon(netService.getConsoleToolWindowIcon());
        Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false);
        Disposer.register(content, console);
        toolWindow.getContentManager().addContent(content);
    }, netService.getProject().getDisposed());
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) Content(com.intellij.ui.content.Content) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel)

Aggregations

TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)11 ConsoleView (com.intellij.execution.ui.ConsoleView)6 NotNull (org.jetbrains.annotations.NotNull)5 Executor (com.intellij.execution.Executor)3 DefaultRunExecutor (com.intellij.execution.executors.DefaultRunExecutor)2 RegexpFilter (com.intellij.execution.filters.RegexpFilter)2 ProcessHandler (com.intellij.execution.process.ProcessHandler)2 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)2 CloseAction (com.intellij.execution.ui.actions.CloseAction)2 Disposable (com.intellij.openapi.Disposable)2 Project (com.intellij.openapi.project.Project)2 Content (com.intellij.ui.content.Content)2 GoConsoleFilter (com.goide.runconfig.GoConsoleFilter)1 DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)1 ExecutionException (com.intellij.execution.ExecutionException)1 ExecutionResult (com.intellij.execution.ExecutionResult)1 CommandLineState (com.intellij.execution.configurations.CommandLineState)1 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1 TextConsoleBuilderImpl (com.intellij.execution.filters.TextConsoleBuilderImpl)1