void (ToolWindowManager toolWindowManager) { JPanel panel = new MavenProjectsNavigatorPanel(myProject, myTree); ActionUtil.wrap("Maven.RemoveRunConfiguration").registerCustomShortcutSet(CommonShortcuts.getDelete(), myTree, this); ActionUtil.wrap("Maven.EditRunConfiguration").registerCustomShortcutSet(CommonShortcuts.getEditSource(), myTree, this); ToolWindow toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, builder -> { builder.icon = MavenIcons.ToolWindowMaven; builder.anchor = ToolWindowAnchor.RIGHT; builder.canCloseContent = false; builder.contentFactory = new ToolWindowFactory() { @Override public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) { } }; return Unit.INSTANCE; }); ContentManager contentManager = toolWindow.getContentManager(); Disposer.register(this, () -> { // fire content removed events, so subscribers could clean up caches if (!myProject.isDisposed()) { contentManager.removeAllContents(true); } Disposer.dispose(contentManager); if (!myProject.isDisposed()) { toolWindow.remove(); } }); final ContentFactory contentFactory = ContentFactory.getInstance(); final Content content = contentFactory.createContent(panel, "", false); contentManager.addContent(content); contentManager.setSelectedContent(content, false); myProject.getMessageBus().connect(content).subscribe(ToolWindowManagerListener.TOPIC, new ToolWindowManagerListener() { boolean wasVisible = false; @Override public void stateChanged(@NotNull ToolWindowManager toolWindowManager) { if (toolWindow.isDisposed()) { return; } boolean visible = ((ToolWindowManagerEx)toolWindowManager).shouldUpdateToolWindowContent(toolWindow); if (!visible || wasVisible) { return; } scheduleStructureUpdate(); wasVisible = true; } }); ActionManager actionManager = ActionManager.getInstance(); DefaultActionGroup group = new DefaultActionGroup(); group.add(actionManager.getAction("Maven.GroupProjects")); group.add(actionManager.getAction("Maven.ShowIgnored")); group.add(actionManager.getAction("Maven.ShowBasicPhasesOnly")); group.add(actionManager.getAction("Maven.AlwaysShowArtifactId")); group.add(actionManager.getAction("Maven.ShowVersions")); toolWindow.setAdditionalGearActions(group); }