public Collection<AbstractVcs> getAffectedVcses() {
   final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
   final Set<AbstractVcs> vcses =
       new HashSet<AbstractVcs>(Arrays.asList(vcsManager.getAllActiveVcss()));
   final Set<AbstractVcs> result = new HashSet<AbstractVcs>();
   for (Change change : myBrowser.myAllChanges) {
     if (vcses.isEmpty()) break;
     final AbstractVcs vcs = ChangesUtil.getVcsForChange(change, myBrowser.myProject);
     if (vcs != null) {
       result.add(vcs);
       vcses.remove(vcs);
     }
   }
   return result;
 }
예제 #2
0
 @NotNull
 public Map<VirtualFile, VcsLogProvider> findLogProviders() {
   Map<VirtualFile, VcsLogProvider> logProviders = ContainerUtil.newHashMap();
   VcsLogProvider[] allLogProviders = Extensions.getExtensions(LOG_PROVIDER_EP, myProject);
   for (AbstractVcs vcs : myVcsManager.getAllActiveVcss()) {
     for (VcsLogProvider provider : allLogProviders) {
       if (provider.getSupportedVcs().equals(vcs.getKeyInstanceMethod())) {
         for (VirtualFile root : myVcsManager.getRootsUnderVcs(vcs)) {
           logProviders.put(root, provider);
         }
         break;
       }
     }
   }
   return logProviders;
 }
예제 #3
0
  public void initToolWindow(ToolWindow toolWindow) {
    // Create panels

    Content allTodosContent =
        ContentFactory.SERVICE
            .getInstance()
            .createContent(null, IdeBundle.message("title.project"), false);
    myAllTodos =
        new TodoPanel(myProject, myAllPanelSettings, false, allTodosContent) {
          protected TodoTreeBuilder createTreeBuilder(
              JTree tree, DefaultTreeModel treeModel, Project project) {
            AllTodosTreeBuilder builder = new AllTodosTreeBuilder(tree, treeModel, project);
            builder.init();
            return builder;
          }
        };
    allTodosContent.setComponent(myAllTodos);
    Disposer.register(this, myAllTodos);

    Content currentFileTodosContent =
        ContentFactory.SERVICE
            .getInstance()
            .createContent(null, IdeBundle.message("title.todo.current.file"), false);
    myCurrentFileTodos =
        new CurrentFileTodosPanel(myProject, myCurrentPanelSettings, currentFileTodosContent) {
          protected TodoTreeBuilder createTreeBuilder(
              JTree tree, DefaultTreeModel treeModel, Project project) {
            CurrentFileTodosTreeBuilder builder =
                new CurrentFileTodosTreeBuilder(tree, treeModel, project);
            builder.init();
            return builder;
          }
        };
    Disposer.register(this, myCurrentFileTodos);
    currentFileTodosContent.setComponent(myCurrentFileTodos);

    myChangeListTodosContent =
        ContentFactory.SERVICE
            .getInstance()
            .createContent(
                null,
                IdeBundle.message(
                    "changelist.todo.title",
                    ChangeListManager.getInstance(myProject).getDefaultChangeList().getName()),
                false);
    myChangeListTodos =
        new ChangeListTodosPanel(myProject, myCurrentPanelSettings, myChangeListTodosContent) {
          protected TodoTreeBuilder createTreeBuilder(
              JTree tree, DefaultTreeModel treeModel, Project project) {
            ChangeListTodosTreeBuilder builder =
                new ChangeListTodosTreeBuilder(tree, treeModel, project);
            builder.init();
            return builder;
          }
        };
    Disposer.register(this, myChangeListTodos);
    myChangeListTodosContent.setComponent(myChangeListTodos);

    myContentManager = toolWindow.getContentManager();

    myContentManager.addContent(allTodosContent);
    myContentManager.addContent(currentFileTodosContent);
    if (myVCSManager.getAllActiveVcss().length > 0) {
      myVcsListener.myIsVisible = true;
      myContentManager.addContent(myChangeListTodosContent);
    }

    Content content = myContentManager.getContent(mySelectedIndex);
    content = content == null ? allTodosContent : content;
    myContentManager.setSelectedContent(content);
  }