Пример #1
0
  private void onRefreshButton() {
    if (context == null || context.getRootFiles().size() == 0) {
      return;
    }

    if (executeStatusSupport != null) {
      executeStatusSupport.cancel();
      executeStatusSupport = null;
    }

    LifecycleManager.getDefault().saveAll();
    RequestProcessor rp = Git.getInstance().getRequestProcessor();
    executeStatusSupport =
        new GitProgressSupport() {

          public void perform() {
            StatusAction.executeStatus(context, this);
            SwingUtilities.invokeLater(
                new Runnable() {

                  public void run() {
                    refreshSetups();
                  }
                });
          }
        };
    String repository = GitUtils.getRootPath(context);
    executeStatusSupport.start(
        rp, repository, NbBundle.getMessage(MultiDiffPanel.class, "MSG_Refresh_Progress"));
  }
Пример #2
0
 /**
  * Semantics is similar to {@link org.openide.windows.TopComponent#getActivatedNodes()} except
  * that this method returns File objects instead od Nodes. Every node is examined for Files it
  * represents. File and Folder nodes represent their underlying files or folders. Project nodes
  * are represented by their source groups. Other logical nodes must provide FileObjects in their
  * Lookup.
  *
  * @return File [] array of activated files
  * @param nodes or null (then taken from windowsystem, it may be wrong on editor tabs #66700).
  */
 public static Context getCurrentContext(Node[] nodes) {
   if (nodes == null) {
     nodes = TopComponent.getRegistry().getActivatedNodes();
   }
   if (Arrays.equals(contextNodesCached.get(), nodes)) {
     Context ctx = contextCached.get();
     if (ctx != null) return ctx;
   }
   VCSContext vcsCtx = VCSContext.forNodes(nodes);
   Context ctx =
       new Context(
           new HashSet(vcsCtx.computeFiles(cvsFileFilter)),
           new HashSet(vcsCtx.getRootFiles()),
           new HashSet(vcsCtx.getExclusions()));
   contextCached = new WeakReference<Context>(ctx);
   contextNodesCached = new WeakReference<Node[]>(nodes);
   return ctx;
 }
 protected static Entry<File, File[]> getActionRoots(VCSContext context) {
   Set<File> repositories = GitUtils.getRepositoryRoots(context);
   if (repositories.isEmpty()) {
     LOG.log(
         Level.FINE, "No repository in the given context: {0}", context.getRootFiles()); // NOI18N
     return null;
   }
   SimpleImmutableEntry<File, File[]> actionRoots = GitUtils.getActionRoots(context);
   if (actionRoots != null) {
     File repository = actionRoots.getKey();
     if (repositories.size() > 1) {
       LOG.log(
           Level.FINE,
           "Multiple repositories in the given context: {0}, selected {1}",
           new Object[] {context.getRootFiles(), repository}); // NOI18N
     }
   }
   return actionRoots;
 }
Пример #4
0
 private boolean affectsView(PropertyChangeEvent event) {
   StatusCache.ChangedEvent changedEvent = (StatusCache.ChangedEvent) event.getNewValue();
   File file = changedEvent.getFile();
   StatusInfo oldInfo = changedEvent.getOldInfo();
   StatusInfo newInfo = changedEvent.getNewInfo();
   if (oldInfo == null) {
     if ((newInfo.getStatus() & displayStatuses) == 0) {
       return false;
     }
   } else {
     if ((oldInfo.getStatus() & displayStatuses) + (newInfo.getStatus() & displayStatuses) == 0) {
       return false;
     }
   }
   return context == null ? false : context.contains(file);
 }