private SubscriberChangeEvent[] handleRemovedRoot(IResource removedRoot) { // Determine if any of the roots of the compare are affected List removals = new ArrayList(resources.length); for (int j = 0; j < resources.length; j++) { IResource root = resources[j]; if (removedRoot.getFullPath().isPrefixOf(root.getFullPath())) { // The root is no longer managed by CVS removals.add(root); try { tree.flushVariants(root, IResource.DEPTH_INFINITE); } catch (TeamException e) { CVSProviderPlugin.log(e); } } } if (removals.isEmpty()) { return new SubscriberChangeEvent[0]; } // Adjust the roots of the subscriber List newRoots = new ArrayList(resources.length); newRoots.addAll(Arrays.asList(resources)); newRoots.removeAll(removals); resources = (IResource[]) newRoots.toArray(new IResource[newRoots.size()]); // Create the deltas for the removals SubscriberChangeEvent[] deltas = new SubscriberChangeEvent[removals.size()]; for (int i = 0; i < deltas.length; i++) { deltas[i] = new SubscriberChangeEvent( this, ISubscriberChangeEvent.ROOT_REMOVED, (IResource) removals.get(i)); } return deltas; }
public IStatus asStatus() { if (errors.isEmpty()) { List result = new ArrayList(); accumulateStatus( (IResource[]) addedRoots.toArray(new IResource[addedRoots.size()]), result, ADDED); accumulateStatus( (IResource[]) removedRoots.toArray(new IResource[removedRoots.size()]), result, REMOVED); accumulateStatus( (IResource[]) movedRoots.toArray(new IResource[movedRoots.size()]), result, MOVED); accumulateStatus( (IResource[]) copiedRoots.toArray(new IResource[copiedRoots.size()]), result, COPIED); accumulateStatus( (IResource[]) changedRoots.toArray(new IResource[changedRoots.size()]), result, CHANGED); accumulateStatus( (IResource[]) closedProjects.toArray(new IResource[closedProjects.size()]), result, CLOSED); if (!result.isEmpty()) { if (result.size() == 1) return (IStatus) result.get(0); return new MultiStatus( "org.eclipse.core.tests.resources", 0, (IStatus[]) result.toArray(new IStatus[result.size()]), "Changes were validated", null); } return Status.OK_STATUS; } else if (errors.size() == 1) { return (IStatus) errors.get(0); } return new MultiStatus( "org.eclipse.core.tests.resources", 0, (IStatus[]) errors.toArray(new IStatus[errors.size()]), "Errors occurred", null); }