Java 类com.intellij.util.ContentsUtil 实例源码

项目:intellij-ce-playground    文件:GitSkippedCommits.java   
/**
 * Show skipped commits
 *
 * @param project        the context project
 * @param skippedCommits the skipped commits
 */
public static void showSkipped(final Project project, final SortedMap<VirtualFile, List<GitRebaseUtils.CommitInfo>> skippedCommits) {
  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      ContentManager contentManager = ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager();
      if (contentManager == null) {
        return;
      }
      GitSkippedCommits skipped = new GitSkippedCommits(contentManager, project, skippedCommits);
      Content content = ContentFactory.SERVICE.getInstance().createContent(skipped, "Skipped Commits", true);
      ContentsUtil.addContent(contentManager, content, true);
      ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS).activate(null);
    }
  });
}
项目:intellij-ce-playground    文件:ShowSvnMapAction.java   
public void actionPerformed(final AnActionEvent e) {
  final Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }

  final CopiesPanel copiesPanel = new CopiesPanel(project);
  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
  final ContentManager contentManager = toolWindow.getContentManager();

  Content content = ContentFactory.SERVICE.getInstance().createContent(copiesPanel.getComponent(), SvnBundle.message("dialog.show.svn.map.title"), true);
  ContentsUtil.addOrReplaceContent(contentManager, content, true);
  toolWindow.activate(new Runnable() {
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPreferredFocusedComponent(), true);
    }
  });
  /*SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPrefferedFocusComponent(), true);
    }
  });*/
}
项目:intellij-ce-playground    文件:IntersectingLocalChangesPanel.java   
public static void showInVersionControlToolWindow(final Project project, final String title, final List<FilePath> filesToShow,
                                                  final String prompt) {
  final IntersectingLocalChangesPanel component = new IntersectingLocalChangesPanel(project, filesToShow, prompt);

  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
  final ContentManager contentManager = toolWindow.getContentManager();

  Content content = ContentFactory
    .SERVICE.getInstance().createContent(component.getPanel(), title, true);
  ContentsUtil.addContent(contentManager, content, true);
  toolWindow.activate(new Runnable() {
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(component.getPrefferedFocusComponent(), true);
    }
  });

}
项目:intellij-ce-playground    文件:SvnMergeSourceDetails.java   
public static void showMe(final Project project, final SvnFileRevision revision, final VirtualFile file) {
  if (ModalityState.NON_MODAL.equals(ModalityState.current())) {
  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
  final ContentManager contentManager = toolWindow.getContentManager();

  final MyDialog dialog = new MyDialog(project, revision, file);
  // TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked
  Disposer.register(project, dialog.getDisposable());

  Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(),
      SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true);
  ContentsUtil.addOrReplaceContent(contentManager, content, true);

  toolWindow.activate(null);
  } else {
    new MyDialog(project, revision, file).show();
  }
}
项目:tools-idea    文件:ProjectLevelVcsManagerImpl.java   
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;
}
项目:tools-idea    文件:GitSkippedCommits.java   
/**
 * Show skipped commits
 *
 * @param project        the context project
 * @param skippedCommits the skipped commits
 */
public static void showSkipped(final Project project, final SortedMap<VirtualFile, List<GitRebaseUtils.CommitInfo>> skippedCommits) {
  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      ContentManager contentManager = ProjectLevelVcsManagerEx.getInstanceEx(project).getContentManager();
      if (contentManager == null) {
        return;
      }
      GitSkippedCommits skipped = new GitSkippedCommits(contentManager, project, skippedCommits);
      Content content = ContentFactory.SERVICE.getInstance().createContent(skipped, "Skipped Commits", true);
      ContentsUtil.addContent(contentManager, content, true);
      ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS).activate(null);
    }
  });
}
项目:tools-idea    文件:ShowSvnMapAction.java   
public void actionPerformed(final AnActionEvent e) {
  final Project project = e.getData(PlatformDataKeys.PROJECT);
  if (project == null) {
    return;
  }

  final CopiesPanel copiesPanel = new CopiesPanel(project);
  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
  final ContentManager contentManager = toolWindow.getContentManager();

  Content content = ContentFactory.SERVICE.getInstance().createContent(copiesPanel.getComponent(), SvnBundle.message("dialog.show.svn.map.title"), true);
  ContentsUtil.addOrReplaceContent(contentManager, content, true);
  toolWindow.activate(new Runnable() {
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPreferredFocusedComponent(), true);
    }
  });
  /*SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(copiesPanel.getPrefferedFocusComponent(), true);
    }
  });*/
}
项目:tools-idea    文件:IntersectingLocalChangesPanel.java   
public static void showInVersionControlToolWindow(final Project project, final String title, final List<FilePath> filesToShow,
                                                  final String prompt) {
  final IntersectingLocalChangesPanel component = new IntersectingLocalChangesPanel(project, filesToShow, prompt);

  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
  final ContentManager contentManager = toolWindow.getContentManager();

  Content content = ContentFactory
    .SERVICE.getInstance().createContent(component.getPanel(), title, true);
  ContentsUtil.addContent(contentManager, content, true);
  toolWindow.activate(new Runnable() {
    public void run() {
      IdeFocusManager.getInstance(project).requestFocus(component.getPrefferedFocusComponent(), true);
    }
  });

}
项目:tools-idea    文件:SvnMergeSourceDetails.java   
public static void showMe(final Project project, final SvnFileRevision revision, final VirtualFile file) {
  if (ModalityState.NON_MODAL.equals(ModalityState.current())) {
  ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
  final ContentManager contentManager = toolWindow.getContentManager();

  final MyDialog dialog = new MyDialog(project, revision, file);

  Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(),
      SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true);
  ContentsUtil.addOrReplaceContent(contentManager, content, true);

  toolWindow.activate(null);
  } else {
    new MyDialog(project, revision, file).show();
  }
}
项目:consulo    文件:PanelWithActionsAndCloseButton.java   
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);
      }
    }
  }
}
项目:consulo    文件:VcsLogContentProvider.java   
private void closeLogTabs() {
  ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS);

  if (toolWindow != null) {
    for (Content content : toolWindow.getContentManager().getContents()) {
      if (ContentUtilEx.isContentTab(content, TAB_NAME)) {
        ContentsUtil.closeContentTab(toolWindow.getContentManager(), content);
      }
    }
  }
}