コード例 #1
0
 @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);
   Content content =
       ContentFactory.SERVICE
           .getInstance()
           .createContent(
               updateInfoTree,
               canceled
                   ? VcsBundle.message(
                       "toolwindow.title.update.action.canceled.info", displayActionName)
                   : VcsBundle.message("toolwindow.title.update.action.info", displayActionName),
               true);
   Disposer.register(content, updateInfoTree);
   ContentsUtil.addContent(contentManager, content, true);
   ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null);
   updateInfoTree.expandRootChildren();
   return updateInfoTree;
 }
コード例 #2
0
 public void actionPerformed(AnActionEvent e) {
   if (myContentManager != null) {
     Content content = myContentManager.getContent(PanelWithActionsAndCloseButton.this);
     if (content != null) {
       ContentsUtil.closeContentTab(myContentManager, content);
       if (content instanceof TabbedContent && ((TabbedContent) content).getTabs().size() > 1) {
         final TabbedContent tabbedContent = (TabbedContent) content;
         final JComponent component = content.getComponent();
         tabbedContent.removeContent(component);
         myContentManager.setSelectedContent(
             content, true, true); // we should request focus here
       } else {
         myContentManager.removeContent(content, true);
       }
     }
   }
 }