Search in sources :

Example 1 with ThreadDumpPanel

use of com.intellij.unscramble.ThreadDumpPanel 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)

Aggregations

TextConsoleBuilder (com.intellij.execution.filters.TextConsoleBuilder)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 Disposable (com.intellij.openapi.Disposable)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 Content (com.intellij.ui.content.Content)1 ThreadDumpPanel (com.intellij.unscramble.ThreadDumpPanel)1