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;
  }
  /* (non-Javadoc)
   * @see org.eclipse.team.core.subscribers.ITeamResourceChangeListener#teamResourceChanged(org.eclipse.team.core.subscribers.TeamDelta[])
   */
  public void subscriberResourceChanged(ISubscriberChangeEvent[] deltas) {
    List outgoingDeltas = new ArrayList(deltas.length);
    for (int i = 0; i < deltas.length; i++) {
      ISubscriberChangeEvent delta = deltas[i];
      if ((delta.getFlags() & ISubscriberChangeEvent.ROOT_REMOVED) != 0) {
        IResource resource = delta.getResource();
        outgoingDeltas.addAll(Arrays.asList(handleRemovedRoot(resource)));
      } else if ((delta.getFlags() & ISubscriberChangeEvent.SYNC_CHANGED) != 0) {
        IResource resource = delta.getResource();
        try {
          if (isSupervised(resource)) {
            outgoingDeltas.add(new SubscriberChangeEvent(this, delta.getFlags(), resource));
          }
        } catch (TeamException e) {
          // Log and ignore
          CVSProviderPlugin.log(e);
        }
      }
    }

    fireTeamResourceChange(
        (SubscriberChangeEvent[])
            outgoingDeltas.toArray(new SubscriberChangeEvent[outgoingDeltas.size()]));
  }