void (@NotNull Project project, @NotNull ToolWindow window) { ThreadingAssertions.assertEventDispatchThread(); ProblemsViewState state = ProblemsViewState.getInstance(project); state.setShowToolbar(ToggleToolbarAction.isToolbarVisible(window, project)); ContentManager manager = window.getContentManager(); CompletableFuture<?> result = CompletableFuture.completedFuture(null); for (ProblemsViewPanelProvider provider : ProblemsViewPanelProvider.getEP().getExtensionList(project)) { ProblemsViewTab panel = provider.create(); if (panel != null) { createContent(manager, panel); if (panel instanceof HighlightingPanel) { CompletableFuture<Void> future = new CompletableFuture<>(); ((HighlightingPanel)panel).updateSelectedFile() .onError(throwable -> future.completeExceptionally(throwable)) .onSuccess(__->future.complete(null)); result = result.thenCompose(__->future); } } } result.thenRun(() -> ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed() || manager.isDisposed()) return; String selectedTabId = state.getSelectedTabId(); if (selectedTabId != null) { ProblemsViewToolWindowUtils.INSTANCE.selectContent(manager, selectedTabId); } Content selectedContent = manager.getSelectedContent(); if (selectedContent != null) { selectionChanged(true, selectedContent); } manager.addContentManagerListener(new ContentManagerListener() { @Override public void selectionChanged(@NotNull ContentManagerEvent event) { boolean selected = ContentManagerEvent.ContentOperation.add == event.getOperation(); JComponent component = event.getContent().getComponent(); if (component instanceof ProblemsViewTab problemsView) { ProblemsView.selectionChanged(selected, event.getContent()); if (selected) { state.setSelectedTabId(problemsView.getTabId()); } } } }); project.getMessageBus().connect(manager).subscribe(ToolWindowManagerListener.TOPIC, createListener()); })); }