private boolean isOurContentPaneShowing() { if (myToolWindowManager.isToolWindowRegistered(TOOLWINDOW_ID) && myToolWindow.isVisible()) { Content content = myToolWindow.getContentManager().getSelectedContent(); return content != null && content.getTabName().equals(VcsLogContentProvider.TAB_NAME); } return false; }
public PostponeableLogRefresher( @NotNull Project project, @NotNull VcsLogDataHolder dataHolder) { myDataHolder = dataHolder; myToolWindowManager = (ToolWindowManagerImpl) ToolWindowManager.getInstance(project); myToolWindow = (ToolWindowImpl) myToolWindowManager.getToolWindow(TOOLWINDOW_ID); Disposer.register(myToolWindow.getContentManager(), this); myPostponedEventsListener = new MyRefreshPostponedEventsListener(); myToolWindow.getContentManager().addContentManagerListener(myPostponedEventsListener); myToolWindowManager.addToolWindowManagerListener(myPostponedEventsListener); }
@Nullable public static ToolWindow ensureToolWindowContentInitialized( @NotNull Project project, @NotNull ProjectSystemId externalSystemId) { final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (toolWindowManager == null) return null; final ToolWindow toolWindow = toolWindowManager.getToolWindow(externalSystemId.getReadableName()); if (toolWindow == null) return null; if (toolWindow instanceof ToolWindowImpl) { ((ToolWindowImpl) toolWindow).ensureContentInitialized(); } return toolWindow; }
@Override public void dispose() { myToolWindow.getContentManager().removeContentManagerListener(myPostponedEventsListener); myToolWindowManager.removeToolWindowManagerListener(myPostponedEventsListener); }