/** * Set the requested content "selected" and show ToolWindow if it hided * * @param displayName * @param wait */ public void showContent(String displayName, final int wait) { // Project project = // DataKeys.PROJECT.getData(DataManager.getInstance().getDataContext()); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); ToolWindow wm = toolWindowManager.getToolWindow(QUERY_RESULT_PANE); if (wm == null) { wm = toolWindowManager.registerToolWindow(QUERY_RESULT_PANE, true, ToolWindowAnchor.BOTTOM); wm.setIcon(Icons.QUERY_RESULT_PANE); wm.setToHideOnEmptyContent(true); } String contentName = connectionManager.getDbUrl().getUserHostPortServiceName().toLowerCase(); Content content = wm.getContentManager().findContent(contentName); if (content == null) { return; } wm.getContentManager().setSelectedContent(content); JTabbedPane tabbedPane = getTabComponent(content); int index = tabbedPane.indexOfTab(displayName); if (index == -1) { return; } tabbedPane.requestFocusInWindow(); tabbedPane.setSelectedIndex(index); if (!wm.isVisible()) { wm.activate( new Runnable() { public void run() { try { Thread.sleep(wait); } catch (InterruptedException e1) { } } // }, false); }, true); } }