private void createOrSelectContentIfNeeded() { ToolWindow toolWindow = getToolWindow(myVcs.getProject()); if (myRefresherI.isFirstTime()) { ContentManager manager = toolWindow.getContentManager(); boolean selectedExistingContent = ContentUtilEx.selectContent(manager, myFileHistoryPanel, true); if (!selectedExistingContent) { ContentUtilEx.addTabbedContent( manager, myFileHistoryPanel, "History", myPath.getName(), true); } toolWindow.activate(null); } }
@Nullable static FileHistoryRefresherI findExistingHistoryRefresher( @NotNull Project project, @NotNull final FilePath path) { JComponent component = ContentUtilEx.findContentComponent( getToolWindow(project).getContentManager(), new Condition<JComponent>() { @Override public boolean value(JComponent component) { return component instanceof FileHistoryPanelImpl && ((FileHistoryPanelImpl) component).getFilePath().equals(path); } }); return component == null ? null : ((FileHistoryPanelImpl) component).getRefresher(); }
@Override public UpdateInfoTree showUpdateProjectInfo( UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo, boolean canceled) { if (!myProject.isOpen() || myProject.isDisposed()) return null; ContentManager contentManager = getContentManager(); if (contentManager == null) { return null; // content manager is made null during dispose; flag is set later } final UpdateInfoTree updateInfoTree = new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo); ContentUtilEx.addTabbedContent( contentManager, updateInfoTree, "Update Info", DateFormatUtil.formatDateTime(System.currentTimeMillis()), true, updateInfoTree); ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null); updateInfoTree.expandRootChildren(); return updateInfoTree; }