Exemplo n.º 1
0
 /**
  * Method filterResources filters the given resources using the given working set.
  *
  * @param current
  * @param resources
  * @return ICVSRemoteResource[]
  */
 public ICVSRemoteResource[] filterResources(
     IWorkingSet workingSet, ICVSRemoteResource[] resources) {
   if (workingSet == null) return resources;
   // get the projects associated with the working set
   IAdaptable[] adaptables = workingSet.getElements();
   Set projects = new HashSet();
   for (int i = 0; i < adaptables.length; i++) {
     IAdaptable adaptable = adaptables[i];
     Object adapted = adaptable.getAdapter(IResource.class);
     if (adapted != null) {
       // Can this code be generalized?
       IProject project = ((IResource) adapted).getProject();
       projects.add(project);
     }
   }
   List result = new ArrayList();
   for (int i = 0; i < resources.length; i++) {
     ICVSRemoteResource resource = resources[i];
     for (Iterator iter = projects.iterator(); iter.hasNext(); ) {
       IProject project = (IProject) iter.next();
       if (project.getName().equals(resource.getName())) {
         result.add(resource);
         break;
       }
     }
   }
   return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]);
 }
Exemplo n.º 2
0
 /** A repository root has been added. Notify any listeners. */
 public void rootAdded(ICVSRepositoryLocation root) {
   Iterator it = listeners.iterator();
   while (it.hasNext()) {
     IRepositoryListener listener = (IRepositoryListener) it.next();
     listener.repositoryAdded(root);
   }
 }
Exemplo n.º 3
0
 private void broadcastRepositoriesChanged(ICVSRepositoryLocation[] roots) {
   if (roots.length == 0) return;
   Iterator it = listeners.iterator();
   while (it.hasNext()) {
     IRepositoryListener listener = (IRepositoryListener) it.next();
     listener.repositoriesChanged(roots);
   }
 }
Exemplo n.º 4
0
 private void writeState(XMLWriter writer) {
   writer.startTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG, null, true);
   // Write the repositories
   Collection repos = Arrays.asList(getKnownRepositoryLocations());
   Iterator it = repos.iterator();
   while (it.hasNext()) {
     CVSRepositoryLocation location = (CVSRepositoryLocation) it.next();
     RepositoryRoot root = getRepositoryRootFor(location);
     root.writeState(writer);
   }
   writer.endTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG);
 }
Exemplo n.º 5
0
 /** Purge any cahced information. */
 public void purgeCache() {
   for (Iterator iter = repositoryRoots.values().iterator(); iter.hasNext(); ) {
     RepositoryRoot root = (RepositoryRoot) iter.next();
     root.clearCache();
   }
 }