public void ensureVisible(Project project) { if (project == null) { return; } ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (toolWindowManager != null) { ToolWindow toolWindow = toolWindowManager.getToolWindow(COMMIT_LOGS_TOOLWINDOW_ID); if (toolWindow != null) { toolWindow.activate(null); } } }
private boolean isProjectViewVisible() { final Window frame = SwingUtilities.getWindowAncestor(this); if (frame instanceof IdeFrameImpl) { final Project project = ((IdeFrameImpl) frame).getProject(); if (project != null) { if (!project.isInitialized()) return true; ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW); return toolWindow != null && toolWindow.isVisible(); } } return false; }
private void initialize() { if (!_isInitialized) { _isInitialized = true; _isDisposed = false; ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(_project); ToolWindow toolWindow = toolWindowManager.registerToolWindow( COMMIT_LOGS_TOOLWINDOW_ID, true, ToolWindowAnchor.BOTTOM); toolWindow.setIcon(COMMIT_LOGS_SMALL_ICON); _contentManager = toolWindow.getContentManager(); toolWindow.installWatcher(_contentManager); // _contentManager = // PeerFactory.getInstance().getContentFactory().createContentManager(true, _project); _contentManager.addContentManagerListener( new ContentManagerAdapter() { @Override public void contentRemoved(ContentManagerEvent event) { JComponent component = event.getContent().getComponent(); JComponent removedComponent = (component instanceof CommitLogWindowComponent) ? ((CommitLogWindowComponent) component).getComponent() : component; // if (removedComponent == myErrorsView) { // myErrorsView.dispose(); // myErrorsView = null; // } else for (Iterator iterator = _commitLogs.iterator(); iterator.hasNext(); ) { Editor editor = (Editor) iterator.next(); if (removedComponent == editor.getComponent()) { EditorFactory.getInstance().releaseEditor(editor); iterator.remove(); } } } }); // final JComponent component = _contentManager.getComponent(); } }