/* (non-Javadoc)
  * @see org.eclipse.team.core.subscribers.SyncInfoSetChangeSetCollector#add(org.eclipse.team.core.synchronize.SyncInfo[])
  */
 protected void add(SyncInfo[] infos) {
   LogEntryCacheUpdateHandler handler = getLogEntryHandler();
   if (handler != null)
     try {
       handler.fetch(infos);
     } catch (CVSException e) {
       getConfiguration()
           .getSyncInfoSet()
           .addError(new TeamStatus(IStatus.ERROR, CVSUIPlugin.ID, 0, e.getMessage(), e, null));
     }
 }
Ejemplo n.º 2
0
  /**
   * Replace the old repository location with the new one assuming that they are the same location
   * with different authentication informations
   *
   * @param location
   * @param newLocation
   */
  public void replaceRepositoryLocation(
      final ICVSRepositoryLocation oldLocation, final CVSRepositoryLocation newLocation) {

    try {
      run(
          new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor)
                throws InvocationTargetException, InterruptedException {
              RepositoryRoot root = getRepositoryRootFor(oldLocation);
              // Disposing of the old location will result in the deletion of the
              // cached root through a listener callback
              KnownRepositories.getInstance().disposeRepository(oldLocation);

              // Get the new location from the CVS plugin to ensure we use the
              // instance that will be returned by future calls to getRepository()
              boolean isNew =
                  !KnownRepositories.getInstance().isKnownRepository(newLocation.getLocation());
              root.setRepositoryLocation(
                  KnownRepositories.getInstance()
                      .addRepository(newLocation, isNew /* broadcast */));
              add(root);
            }
          },
          Policy.monitorFor(null));
    } catch (InvocationTargetException e) {
      CVSException.wrapException(e);
    } catch (InterruptedException e) {
    }
  }
 /**
  * Ensure that the sync info for all the provided resources has been loaded. If an out-of-sync
  * resource is found, prompt to refresh all the projects involved.
  */
 protected boolean ensureSyncInfoLoaded(IResource[] resources) throws CVSException {
   boolean keepTrying = true;
   while (keepTrying) {
     try {
       EclipseSynchronizer.getInstance().ensureSyncInfoLoaded(resources, getActionDepth());
       keepTrying = false;
     } catch (CVSException e) {
       if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
         // determine the projects of the resources involved
         Set projects = new HashSet();
         for (int i = 0; i < resources.length; i++) {
           IResource resource = resources[i];
           projects.add(resource.getProject());
         }
         // prompt to refresh
         if (promptToRefresh(
             getShell(),
             (IResource[]) projects.toArray(new IResource[projects.size()]),
             e.getStatus())) {
           for (Iterator iter = projects.iterator(); iter.hasNext(); ) {
             IProject project = (IProject) iter.next();
             try {
               project.refreshLocal(IResource.DEPTH_INFINITE, null);
             } catch (CoreException coreException) {
               throw CVSException.wrapException(coreException);
             }
           }
         } else {
           return false;
         }
       } else {
         throw e;
       }
     }
   }
   return true;
 }