コード例 #1
0
 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;
     }
   }
 }
コード例 #2
0
  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;
  }
コード例 #3
0
 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();
         }
       }
     }
   }
 }
コード例 #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)"));
   }
 }