private void removeTab(Content[] contents, String s) {
   myMap.remove(s);
   for (Content content : contents) {
     if (s.equals(content.getDisplayName())) {
       myUi.getContentManager().removeContent(content, false);
       break;
     }
   }
 }
  private int getComponentNumNamed(String s) {
    for (int i = 0; i < getContentManager().getContentCount(); i++) {
      final Content content = getContentManager().getContent(i);
      if (content != null && s.equals(content.getDisplayName())) {
        return i;
      }
    }

    return -1;
  }
 private static void removeContents(
     @Nullable final Content notToRemove,
     @NotNull final Project myProject,
     @NotNull final String tabDisplayName) {
   MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
   Content[] contents = messageView.getContentManager().getContents();
   for (Content content : contents) {
     LOG.assertTrue(content != null);
     if (content.isPinned()) continue;
     if (tabDisplayName.equals(content.getDisplayName()) && content != notToRemove) {
       ErrorTreeView listErrorView = (ErrorTreeView) content.getComponent();
       if (listErrorView != null) {
         if (messageView.getContentManager().removeContent(content, true)) {
           content.release();
         }
       }
     }
   }
 }
Beispiel #4
0
 private static void addHierarchyScope(@NotNull Project project, Collection<SearchScope> result) {
   final ToolWindow toolWindow =
       ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY);
   if (toolWindow == null) {
     return;
   }
   final ContentManager contentManager = toolWindow.getContentManager();
   final Content content = contentManager.getSelectedContent();
   if (content == null) {
     return;
   }
   final String name = content.getDisplayName();
   final JComponent component = content.getComponent();
   if (!(component instanceof HierarchyBrowserBase)) {
     return;
   }
   final HierarchyBrowserBase hierarchyBrowserBase = (HierarchyBrowserBase) component;
   final PsiElement[] elements = hierarchyBrowserBase.getAvailableElements();
   if (elements.length > 0) {
     result.add(new LocalSearchScope(elements, "Hierarchy '" + name + "' (visible nodes only)"));
   }
 }