XDebugTabLayouter () { return new XDebugTabLayouter() { @Override public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) { registerThreadsPanel(ui); registerMemoryViewPanel(ui); registerOverheadMonitor(ui); } @NotNull @Override public Content registerConsoleContent(@NotNull RunnerLayoutUi ui, @NotNull ExecutionConsole console) { Content content = null; if (console instanceof ExecutionConsoleEx) { ((ExecutionConsoleEx)console).buildUi(ui); content = ui.findContent(DebuggerContentInfo.CONSOLE_CONTENT); } if (content == null) { content = super.registerConsoleContent(ui, console); } return content; } private void registerThreadsPanel(@NotNull RunnerLayoutUi ui) { final ThreadsPanel panel = new ThreadsPanel(myJavaSession.getProject(), getDebuggerStateManager()); final Content threadsContent = ui.createContent( DebuggerContentInfo.THREADS_CONTENT, panel, XDebuggerBundle.message("debugger.session.tab.threads.title"), null, panel.getDefaultFocusedComponent()); threadsContent.setCloseable(false); ui.addContent(threadsContent, 0, PlaceInGrid.left, true); ui.addListener(new ContentManagerListener() { @Override public void selectionChanged(@NotNull ContentManagerEvent event) { if (event.getContent() == threadsContent) { if (threadsContent.isSelected()) { panel.setUpdateEnabled(true); if (panel.isRefreshNeeded()) { panel.rebuildIfVisible(DebuggerSession.Event.CONTEXT); } } else { panel.setUpdateEnabled(false); } } } }, threadsContent); } private void registerMemoryViewPanel(@NotNull RunnerLayoutUi ui) { if (!Registry.is("debugger.enable.memory.view")) return; final XDebugSession session = getSession(); final DebugProcessImpl process = myJavaSession.getProcess(); final InstancesTracker tracker = InstancesTracker.getInstance(myJavaSession.getProject()); final ClassesFilteredView classesFilteredView = new ClassesFilteredView(session, process, tracker); final Content memoryViewContent = ui.createContent(MemoryViewManager.MEMORY_VIEW_CONTENT, classesFilteredView, JavaDebuggerBundle.message("memory.toolwindow.title"), null, classesFilteredView.getDefaultFocusedComponent()); memoryViewContent.setCloseable(false); memoryViewContent.setShouldDisposeContent(true); final MemoryViewDebugProcessData data = new MemoryViewDebugProcessData(); process.putUserData(MemoryViewDebugProcessData.KEY, data); session.addSessionListener(new XDebugSessionListener() { @Override public void sessionStopped() { session.removeSessionListener(this); data.getTrackedStacks().clear(); } }); ui.addContent(memoryViewContent, 0, PlaceInGrid.right, true); final DebuggerManagerThreadImpl managerThread = process.getManagerThread(); ui.addListener(new ContentManagerListener() { @Override public void selectionChanged(@NotNull ContentManagerEvent event) { if (event.getContent() == memoryViewContent) { classesFilteredView.setActive(memoryViewContent.isSelected(), managerThread); } } }, memoryViewContent); } private void registerOverheadMonitor(@NotNull RunnerLayoutUi ui) { if (!Registry.is("debugger.enable.overhead.monitor")) return; DebugProcessImpl process = myJavaSession.getProcess(); OverheadView monitor = new OverheadView(process); Content overheadContent = ui.createContent("OverheadMonitor", monitor, JavaDebuggerBundle.message("overhead.toolwindow.title"), null, monitor.getDefaultFocusedComponent()); monitor.setBouncer(() -> ui.setBouncing(overheadContent, true)); overheadContent.setCloseable(false); overheadContent.setShouldDisposeContent(true); ui.addContent(overheadContent, 0, PlaceInGrid.right, true); } }; }