org.eclipse.team.core_3.6.0.I20110525-0800

et #226
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	228	0	this	EventHandler
      //   0	228	1	monitor	IProgressMonitor
      //   33	163	2	locked	ResourceDiffTree[]
      //   48	92	3	iter	Iterator
      //   151	2	3	e	CoreException
      //   61	50	4	event	BackgroundEventHandler.Event
      //   157	35	5	localObject1	Object
      //   168	12	6	localObject2	Object
      //   203	12	6	localObject3	Object
      // Exception table:
      //   from	to	target	type
      //   34	148	151	org/eclipse/core/runtime/CoreException
      //   34	157	157	finally
      //   159	168	168	finally
      //   194	203	203	finally
    }
    
    private ResourceDiffTree[] beginDispath()
    {
      ChangeSet[] sets = getSets();
      List lockedSets = new ArrayList();
      try
      {
        for (int i = 0; i < sets.length; i++)
        {
          ActiveChangeSet set = (ActiveChangeSet)sets[i];
          ResourceDiffTree tree = set.internalGetDiffTree();
          lockedSets.add(tree);
          tree.beginInput();
        }
        return (ResourceDiffTree[])lockedSets.toArray(new ResourceDiffTree[lockedSets.size()]);
      }
      catch (RuntimeException e)
      {
        try
        {
          for (Iterator iter = lockedSets.iterator(); iter.hasNext();)
          {
            ResourceDiffTree tree = (ResourceDiffTree)iter.next();
            try
            {
              tree.endInput(null);
            }
            catch (Throwable localThrowable1) {}
          }
        }
        catch (Throwable localThrowable2) {}
        throw e;
      }
    }
    
    private void endDispatch(ResourceDiffTree[] locked, IProgressMonitor monitor)
    {
      if (locked == null) {
        return;
      }
      monitor.beginTask(null, 100 * locked.length);
      for (int i = 0; i < locked.length; i++)
      {
        ResourceDiffTree tree = locked[i];
        try
        {
          tree.endInput(Policy.subMonitorFor(monitor, 100));
        }
        catch (RuntimeException e)
        {
          TeamPlugin.log(4, Messages.SubscriberChangeSetCollector_0, e);
          throw e;
        }
      }
      monitor.done();
    }
    
    protected synchronized void queueEvent(BackgroundEventHandler.Event event, boolean front)
    {
      super.queueEvent(event, front);
    }
    
    private void handleRemove(IResource resource)
    {
      ChangeSet[] sets = getSets();
      for (int i = 0; i < sets.length; i++)
      {
        ChangeSet set = sets[i];
        if (!set.isEmpty())
        {
          set.rootRemoved(resource, 2);
          if (set.isEmpty()) {
            remove(set);
          }
        }
      }
    }
    
    private void handleChange(IResource resource, int depth)
      throws CoreException
    {
      IDiff diff = getDiff(resource);
      if (isModified(diff))
      {
        ActiveChangeSet[] containingSets = getContainingSets(resource);
        if (containingSets.length == 0)
        {
          if (getDefaultSet() != null) {
            getDefaultSet().add(diff);
          }
        }
        else {
          for (int i = 0; i < containingSets.length; i++)
          {
            ActiveChangeSet set = containingSets[i];
            
            set.add(diff);
          }
        }
      }
      else
      {
        removeFromAllSets(resource);
      }
      if (depth != 0)
      {
        IResource[] members = getSubscriber().members(resource);
        for (int i = 0; i < members.length; i++)
        {
          IResource member = members[i];
          handleChange(member, depth == 1 ? 0 : 2);
        }
      }
    }
    
    private void removeFromAllSets(IResource resource)
    {
      List toRemove = new ArrayList();
      ChangeSet[] sets = getSets();
      for (int i = 0; i < sets.length; i++)
      {
        ChangeSet set = sets[i];
        if (set.contains(resource))
        {
          set.remove(resource);
          if (set.isEmpty()) {
            toRemove.add(set);
          }
        }
      }
      for (Iterator iter = toRemove.iterator(); iter.hasNext();)
      {
        ActiveChangeSet set = (ActiveChangeSet)iter.next();
        remove(set);
      }
    }
    
    private ActiveChangeSet[] getContainingSets(IResource resource)
    {
      Set result = new HashSet();
      ChangeSet[] sets = getSets();
      for (int i = 0; i < sets.length; i++)
      {
        ChangeSet set = sets[i];
        if (set.contains(resource)) {
          result.add(set);
        }
      }
      return (ActiveChangeSet[])result.toArray(new ActiveChangeSet[result.size()]);
    }
  }
  
  private class ResourceCollector
    extends SubscriberResourceCollector
  {
    public ResourceCollector(Subscriber subscriber)
    {
      super();
    }
    
    protected void remove(IResource resource)
    {
      if (handler != null) {
        handler.queueEvent(new BackgroundEventHandler.ResourceEvent(resource, 1, 2), false);
      }
    }
    
    protected void change(IResource resource, int depth)
    {
      if (handler != null) {
        handler.queueEvent(new BackgroundEventHandler.ResourceEvent(resource, 2, depth), false);
      }
    }
    
    protected boolean hasMembers(IResource resource)
    {
      return SubscriberChangeSetManager.this.hasMembers(resource);
    }
  }
  
  public SubscriberChangeSetManager(Subscriber subscriber)
  {
    collector = new ResourceCollector(subscriber);
    handler = new EventHandler(NLS.bind(Messages.SubscriberChangeSetCollector_1, new String[] { subscriber.getName() }), NLS.bind(Messages.SubscriberChangeSetCollector_2, new String[] { subscriber.getName() }));
  }
  
  protected void initializeSets()
  {
    load(getPreferences());
  }
  
  public boolean hasMembers(IResource resource)
  {
    ChangeSet[] sets = getSets();
    for (int i = 0; i < sets.length; i++)
    {
      ActiveChangeSet set = (ActiveChangeSet)sets[i];
      if (set.getDiffTree().getChildren(resource.getFullPath()).length > 0) {
        return true;
      }
    }
    if (getDefaultSet() != null) {
      return getDefaultSet().getDiffTree().getChildren(resource.getFullPath()).length > 0;
    }
    return false;
  }
  
  public IDiff getDiff(IResource resource)
    throws CoreException
  {
    Subscriber subscriber = getSubscriber();
    return subscriber.getDiff(resource);
  }
  
  public Subscriber getSubscriber()
  {
    return collector.getSubscriber();
  }
  
  public void dispose()
  {
    handler.shutdown();
    collector.dispose();
    super.dispose();
    save(getPreferences());
  }
  
  private Preferences getPreferences()
  {
    return getParentPreferences().node(getSubscriberIdentifier());
  }
  
  private static Preferences getParentPreferences()
  {
    return getTeamPreferences().node("changeSets");
  }
  
  private static Preferences getTeamPreferences()
  {
    return new InstanceScope().getNode(TeamPlugin.getPlugin().getBundle().getSymbolicName());
  }
  
  protected String getSubscriberIdentifier()
  {
    return getSubscriber().getName();
  }
  
  public void waitUntilDone(IProgressMonitor monitor)
  {
    monitor.worked(1);
    while (handler.getEventHandlerJob().getState() != 0)
    {
      monitor.worked(1);
      try
      {
        Thread.sleep(10L);
      }
      catch (InterruptedException localInterruptedException) {}
      Policy.checkCanceled(monitor);
    }
    monitor.worked(1);
  }
  
  protected String getName()
  {
    return getSubscriber().getName();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberChangeSetManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.IWorkspaceRunnable;

class SubscriberDiffTreeEventHandler$1
  implements IWorkspaceRunnable
{
  final SubscriberDiffTreeEventHandler this$0;
  
  SubscriberDiffTreeEventHandler$1(SubscriberDiffTreeEventHandler paramSubscriberDiffTreeEventHandler)
  {
    this$0 = paramSubscriberDiffTreeEventHandler;
  }
  
  /* Error */
  public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.core.runtime.CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   4: invokestatic 40	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$1	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
    //   7: iconst_3
    //   8: if_icmpne +99 -> 107
    //   11: aload_0
    //   12: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   15: aload_1
    //   16: invokevirtual 39	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:prepareScope	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   19: aload_0
    //   20: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   23: iconst_5
    //   24: invokestatic 42	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$2	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
    //   27: goto +43 -> 70
    //   30: astore_2
    //   31: aload_0
    //   32: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   35: invokestatic 40	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$1	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
    //   38: iconst_5
    //   39: if_icmpeq +29 -> 68
    //   42: aload_0
    //   43: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   46: iconst_1
    //   47: invokestatic 42	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$2	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
    //   50: aload_0
    //   51: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   54: invokestatic 41	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$3	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
    //   57: ifne +11 -> 68
    //   60: aload_0
    //   61: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   64: iconst_1
    //   65: invokestatic 43	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$4	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
    //   68: aload_2
    //   69: athrow
    //   70: aload_0
    //   71: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   74: invokestatic 40	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$1	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
    //   77: iconst_5
    //   78: if_icmpeq +29 -> 107
    //   81: aload_0
    //   82: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   85: iconst_1
    //   86: invokestatic 42	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$2	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
    //   89: aload_0
    //   90: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   93: invokestatic 41	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$3	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
    //   96: ifne +11 -> 107
    //   99: aload_0
    //   100: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
    //   103: iconst_1
    //   104: invokestatic 43	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$4	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
    //   107: return
    // Line number table:
    //   Java source line #120	-> byte code offset #0
    //   Java source line #122	-> byte code offset #11
    //   Java source line #123	-> byte code offset #19
    //   Java source line #124	-> byte code offset #30
    //   Java source line #127	-> byte code offset #31
    //   Java source line #128	-> byte code offset #42
    //   Java source line #129	-> byte code offset #50
    //   Java source line #130	-> byte code offset #60
    //   Java source line #132	-> byte code offset #68
    //   Java source line #127	-> byte code offset #70
    //   Java source line #128	-> byte code offset #81
    //   Java source line #129	-> byte code offset #89
    //   Java source line #130	-> byte code offset #99
    //   Java source line #134	-> byte code offset #107
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	108	0	this	1
    //   0	108	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   30	39	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   11	30	30	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.diff.IDiffVisitor;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.Policy;

class SubscriberDiffTreeEventHandler$2
  implements IDiffVisitor
{
  final SubscriberDiffTreeEventHandler this$0;
  private final IProgressMonitor val$monitor;
  
  SubscriberDiffTreeEventHandler$2(SubscriberDiffTreeEventHandler paramSubscriberDiffTreeEventHandler, IProgressMonitor paramIProgressMonitor)
  {
    this$0 = paramSubscriberDiffTreeEventHandler;val$monitor = paramIProgressMonitor;
  }
  
  public boolean visit(IDiff diff)
  {
    Policy.checkCanceled(val$monitor);
    val$monitor.subTask(NLS.bind(Messages.SubscriberDiffTreeEventHandler_0, SubscriberDiffTreeEventHandler.access$0(this$0).getResource(diff).getFullPath().toString()));
    
    this$0.queueDispatchEvent(
      new SubscriberDiffTreeEventHandler.SubscriberDiffChangedEvent(this$0, SubscriberDiffTreeEventHandler.access$0(this$0).getResource(diff), 2, 0, diff));
    
    this$0.handlePreemptiveEvents(val$monitor);
    this$0.handlePendingDispatch(val$monitor);
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.diff.IDiff;

class SubscriberDiffTreeEventHandler$SubscriberDiffChangedEvent
  extends SubscriberEventHandler.SubscriberEvent
{
  private final IDiff node;
  final SubscriberDiffTreeEventHandler this$0;
  
  public SubscriberDiffTreeEventHandler$SubscriberDiffChangedEvent(SubscriberDiffTreeEventHandler paramSubscriberDiffTreeEventHandler, IResource resource, int type, int depth, IDiff node)
  {
    super(paramSubscriberDiffTreeEventHandler, resource, type, depth);this$0 = paramSubscriberDiffTreeEventHandler;
    this.node = node;
  }
  
  public IDiff getChangedNode()
  {
    return node;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler.SubscriberDiffChangedEvent
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.core.subscribers.Subscriber;

class SubscriberDiffTreeEventHandler$SubscriberDiffCollector
  extends SubscriberResourceCollector
{
  final SubscriberDiffTreeEventHandler this$0;
  
  public SubscriberDiffTreeEventHandler$SubscriberDiffCollector(SubscriberDiffTreeEventHandler paramSubscriberDiffTreeEventHandler, Subscriber subscriber)
  {
    super(subscriber);
    this$0 = paramSubscriberDiffTreeEventHandler;
  }
  
  protected boolean hasMembers(IResource resource)
  {
    return SubscriberDiffTreeEventHandler.access$0(this$0).members(resource).length > 0;
  }
  
  protected void remove(IResource resource)
  {
    this$0.remove(resource);
  }
  
  protected void change(IResource resource, int depth)
  {
    this$0.change(resource, depth);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler.SubscriberDiffCollector
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.core.subscribers;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamStatus;
import org.eclipse.team.core.diff.DiffFilter;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.diff.IDiffVisitor;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.core.BackgroundEventHandler.RunnableEvent;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.Policy;

public class SubscriberDiffTreeEventHandler
  extends SubscriberEventHandler
{
  private static final int STATE_NEW = 0;
  public static final int STATE_STARTED = 1;
  private static final int STATE_OK_TO_INITIALIZE = 3;
  private static final int STATE_COLLECTING_CHANGES = 5;
  private static final int STATE_SHUTDOWN = 8;
  private static final int EXCEPTION_NONE = 0;
  private static final int EXCEPTION_CANCELED = 1;
  private static final int EXCEPTION_ERROR = 2;
  private ResourceDiffTree tree;
  private SubscriberDiffCollector collector;
  private ISynchronizationScopeManager manager;
  private Object family;
  private DiffFilter filter;
  private int state = 0;
  private int exceptionState = 0;
  
  private class SubscriberDiffChangedEvent
    extends SubscriberEventHandler.SubscriberEvent
  {
    private final IDiff node;
    
    public SubscriberDiffChangedEvent(IResource resource, int type, int depth, IDiff node)
    {
      super(resource, type, depth);
      this.node = node;
    }
    
    public IDiff getChangedNode()
    {
      return node;
    }
  }
  
  private class SubscriberDiffCollector
    extends SubscriberResourceCollector
  {
    public SubscriberDiffCollector(Subscriber subscriber)
    {
      super();
    }
    
    protected boolean hasMembers(IResource resource)
    {
      return tree.members(resource).length > 0;
    }
    
    protected void remove(IResource resource)
    {
      SubscriberDiffTreeEventHandler.this.remove(resource);
    }
    
    protected void change(IResource resource, int depth)
    {
      SubscriberDiffTreeEventHandler.this.change(resource, depth);
    }
  }
  
  public SubscriberDiffTreeEventHandler(Subscriber subscriber, ISynchronizationScopeManager manager, ResourceDiffTree tree, DiffFilter filter)
  {
    super(subscriber, manager.getScope());
    this.manager = manager;
    this.tree = tree;
    collector = new SubscriberDiffCollector(subscriber);
    this.filter = filter;
  }
  
  protected void reset(ResourceTraversal[] traversals, int type)
  {
    exceptionState = 0;
    if ((!manager.isInitialized()) && (state == 3))
    {
      queueEvent(new BackgroundEventHandler.RunnableEvent(new IWorkspaceRunnable()
      {
        /* Error */
        public void run(IProgressMonitor monitor)
          throws CoreException
        {
          // Byte code:
          //   0: aload_0
          //   1: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   4: invokestatic 40	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$1	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
          //   7: iconst_3
          //   8: if_icmpne +99 -> 107
          //   11: aload_0
          //   12: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   15: aload_1
          //   16: invokevirtual 39	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:prepareScope	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
          //   19: aload_0
          //   20: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   23: iconst_5
          //   24: invokestatic 42	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$2	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
          //   27: goto +43 -> 70
          //   30: astore_2
          //   31: aload_0
          //   32: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   35: invokestatic 40	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$1	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
          //   38: iconst_5
          //   39: if_icmpeq +29 -> 68
          //   42: aload_0
          //   43: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   46: iconst_1
          //   47: invokestatic 42	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$2	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
          //   50: aload_0
          //   51: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   54: invokestatic 41	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$3	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
          //   57: ifne +11 -> 68
          //   60: aload_0
          //   61: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   64: iconst_1
          //   65: invokestatic 43	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$4	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
          //   68: aload_2
          //   69: athrow
          //   70: aload_0
          //   71: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   74: invokestatic 40	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$1	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
          //   77: iconst_5
          //   78: if_icmpeq +29 -> 107
          //   81: aload_0
          //   82: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   85: iconst_1
          //   86: invokestatic 42	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$2	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
          //   89: aload_0
          //   90: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   93: invokestatic 41	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$3	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;)I
          //   96: ifne +11 -> 107
          //   99: aload_0
          //   100: getfield 37	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;
          //   103: iconst_1
          //   104: invokestatic 43	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:access$4	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;I)V
          //   107: return
          // Line number table:
          //   Java source line #120	-> byte code offset #0
          //   Java source line #122	-> byte code offset #11
          //   Java source line #123	-> byte code offset #19
          //   Java source line #124	-> byte code offset #30
          //   Java source line #127	-> byte code offset #31
          //   Java source line #128	-> byte code offset #42
          //   Java source line #129	-> byte code offset #50
          //   Java source line #130	-> byte code offset #60
          //   Java source line #132	-> byte code offset #68
          //   Java source line #127	-> byte code offset #70
          //   Java source line #128	-> byte code offset #81
          //   Java source line #129	-> byte code offset #89
          //   Java source line #130	-> byte code offset #99
          //   Java source line #134	-> byte code offset #107
          // Local variable table:
          //   start	length	slot	name	signature
          //   0	108	0	this	1
          //   0	108	1	monitor	IProgressMonitor
          //   30	39	2	localObject	Object
          // Exception table:
          //   from	to	target	type
          //   11	30	30	finally
        }
      }, true), true);
    }
    else if (manager.isInitialized())
    {
      state = 5;
      super.reset(traversals, type);
    }
  }
  
  public void reset()
  {
    reset(getScope().getTraversals(), 
      3);
  }
  
  protected void prepareScope(IProgressMonitor monitor)
  {
    try
    {
      manager.initialize(monitor);
    }
    catch (CoreException e)
    {
      handleException(e);
    }
    ResourceTraversal[] traversals = manager.getScope().getTraversals();
    if (traversals.length > 0) {
      reset(traversals, 3);
    }
  }
  
  protected void handleChange(IResource resource)
    throws CoreException
  {
    IDiff node = getSubscriber().getDiff(resource);
    if (node == null) {
      queueDispatchEvent(
        new SubscriberEventHandler.SubscriberEvent(this, resource, 1, 0));
    } else if (isInScope(resource)) {
      queueDispatchEvent(
        new SubscriberDiffChangedEvent(resource, 2, 0, node));
    }
  }
  
  private boolean isInScope(IResource resource)
  {
    return manager.getScope().contains(resource);
  }
  
  /* Error */
  protected void collectAll(IResource resource, int depth, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_3
    //   1: invokestatic 306	org/eclipse/team/internal/core/Policy:checkCanceled	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   4: aload_3
    //   5: aconst_null
    //   6: iconst_m1
    //   7: invokeinterface 339 3 0
    //   12: iconst_1
    //   13: anewarray 139	org/eclipse/core/resources/mapping/ResourceTraversal
    //   16: dup
    //   17: iconst_0
    //   18: new 139	org/eclipse/core/resources/mapping/ResourceTraversal
    //   21: dup
    //   22: iconst_1
    //   23: anewarray 136	org/eclipse/core/resources/IResource
    //   26: dup
    //   27: iconst_0
    //   28: aload_1
    //   29: aastore
    //   30: iload_2
    //   31: iconst_0
    //   32: invokespecial 293	org/eclipse/core/resources/mapping/ResourceTraversal:<init>	([Lorg/eclipse/core/resources/IResource;II)V
    //   35: aastore
    //   36: astore 4
    //   38: aload_0
    //   39: invokevirtual 311	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:getSubscriber	()Lorg/eclipse/team/core/subscribers/Subscriber;
    //   42: aload 4
    //   44: new 156	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$2
    //   47: dup
    //   48: aload_0
    //   49: aload_3
    //   50: invokespecial 317	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$2:<init>	(Lorg/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   53: invokevirtual 304	org/eclipse/team/core/subscribers/Subscriber:accept	([Lorg/eclipse/core/resources/mapping/ResourceTraversal;Lorg/eclipse/team/core/diff/IDiffVisitor;)V
    //   56: goto +52 -> 108
    //   59: astore 5
    //   61: aload_1
    //   62: invokeinterface 336 1 0
    //   67: invokeinterface 335 1 0
    //   72: ifeq +16 -> 88
    //   75: aload_0
    //   76: aload 5
    //   78: aload_1
    //   79: iconst_2
    //   80: aload 5
    //   82: invokevirtual 294	org/eclipse/core/runtime/CoreException:getMessage	()Ljava/lang/String;
    //   85: invokevirtual 315	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:handleException	(Lorg/eclipse/core/runtime/CoreException;Lorg/eclipse/core/resources/IResource;ILjava/lang/String;)V
    //   88: aload_3
    //   89: invokeinterface 338 1 0
    //   94: goto +20 -> 114
    //   97: astore 6
    //   99: aload_3
    //   100: invokeinterface 338 1 0
    //   105: aload 6
    //   107: athrow
    //   108: aload_3
    //   109: invokeinterface 338 1 0
    //   114: return
    // Line number table:
    //   Java source line #182	-> byte code offset #0
    //   Java source line #183	-> byte code offset #4
    //   Java source line #184	-> byte code offset #12
    //   Java source line #186	-> byte code offset #38
    //   Java source line #199	-> byte code offset #59
    //   Java source line #200	-> byte code offset #61
    //   Java source line #201	-> byte code offset #75
    //   Java source line #203	-> byte code offset #88
    //   Java source line #202	-> byte code offset #97
    //   Java source line #203	-> byte code offset #99
    //   Java source line #204	-> byte code offset #105
    //   Java source line #203	-> byte code offset #108
    //   Java source line #205	-> byte code offset #114
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	115	0	this	SubscriberDiffTreeEventHandler
    //   0	115	1	resource	IResource
    //   0	115	2	depth	int
    //   0	115	3	monitor	IProgressMonitor
    //   36	7	4	traversals	ResourceTraversal[]
    //   59	22	5	e	CoreException
    //   97	9	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   38	56	59	org/eclipse/core/runtime/CoreException
    //   38	88	97	finally
  }
  
  /* Error */
  protected void dispatchEvents(SubscriberEventHandler.SubscriberEvent[] events, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 290	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:tree	Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   4: invokevirtual 297	org/eclipse/team/core/mapping/provider/ResourceDiffTree:beginInput	()V
    //   7: iconst_0
    //   8: istore_3
    //   9: goto +156 -> 165
    //   12: aload_1
    //   13: iload_3
    //   14: aaload
    //   15: astore 4
    //   17: aload 4
    //   19: invokevirtual 332	org/eclipse/team/internal/core/subscribers/SubscriberEventHandler$SubscriberEvent:getType	()I
    //   22: tableswitch	default:+140->162, 1:+81->103, 2:+22->44
    //   44: aload 4
    //   46: instanceof 157
    //   49: ifeq +113 -> 162
    //   52: aload 4
    //   54: checkcast 157	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$SubscriberDiffChangedEvent
    //   57: astore 5
    //   59: aload 5
    //   61: invokevirtual 318	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler$SubscriberDiffChangedEvent:getChangedNode	()Lorg/eclipse/team/core/diff/IDiff;
    //   64: astore 6
    //   66: aload 6
    //   68: invokeinterface 340 1 0
    //   73: ifne +20 -> 93
    //   76: aload_0
    //   77: getfield 290	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:tree	Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   80: aload 6
    //   82: invokeinterface 341 1 0
    //   87: invokevirtual 298	org/eclipse/team/core/mapping/provider/ResourceDiffTree:remove	(Lorg/eclipse/core/runtime/IPath;)V
    //   90: goto +72 -> 162
    //   93: aload_0
    //   94: aload 6
    //   96: aload_2
    //   97: invokespecial 314	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:addDiff	(Lorg/eclipse/team/core/diff/IDiff;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   100: goto +62 -> 162
    //   103: aload_0
    //   104: getfield 290	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:tree	Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   107: iconst_1
    //   108: anewarray 139	org/eclipse/core/resources/mapping/ResourceTraversal
    //   111: dup
    //   112: iconst_0
    //   113: aload 4
    //   115: invokevirtual 333	org/eclipse/team/internal/core/subscribers/SubscriberEventHandler$SubscriberEvent:asTraversal	()Lorg/eclipse/core/resources/mapping/ResourceTraversal;
    //   118: aastore
    //   119: invokevirtual 302	org/eclipse/team/core/mapping/provider/ResourceDiffTree:getDiffs	([Lorg/eclipse/core/resources/mapping/ResourceTraversal;)[Lorg/eclipse/team/core/diff/IDiff;
    //   122: astore 5
    //   124: iconst_0
    //   125: istore 6
    //   127: goto +27 -> 154
    //   130: aload 5
    //   132: iload 6
    //   134: aaload
    //   135: astore 7
    //   137: aload_0
    //   138: getfield 290	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:tree	Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   141: aload 7
    //   143: invokeinterface 341 1 0
    //   148: invokevirtual 298	org/eclipse/team/core/mapping/provider/ResourceDiffTree:remove	(Lorg/eclipse/core/runtime/IPath;)V
    //   151: iinc 6 1
    //   154: iload 6
    //   156: aload 5
    //   158: arraylength
    //   159: if_icmplt -29 -> 130
    //   162: iinc 3 1
    //   165: iload_3
    //   166: aload_1
    //   167: arraylength
    //   168: if_icmplt -156 -> 12
    //   171: goto +16 -> 187
    //   174: astore 8
    //   176: aload_0
    //   177: getfield 290	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:tree	Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   180: aload_2
    //   181: invokevirtual 299	org/eclipse/team/core/mapping/provider/ResourceDiffTree:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   184: aload 8
    //   186: athrow
    //   187: aload_0
    //   188: getfield 290	org/eclipse/team/internal/core/subscribers/SubscriberDiffTreeEventHandler:tree	Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   191: aload_2
    //   192: invokevirtual 299	org/eclipse/team/core/mapping/provider/ResourceDiffTree:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   195: return
    // Line number table:
    //   Java source line #213	-> byte code offset #0
    //   Java source line #214	-> byte code offset #7
    //   Java source line #215	-> byte code offset #12
    //   Java source line #216	-> byte code offset #17
    //   Java source line #218	-> byte code offset #44
    //   Java source line #219	-> byte code offset #52
    //   Java source line #220	-> byte code offset #59
    //   Java source line #221	-> byte code offset #66
    //   Java source line #222	-> byte code offset #76
    //   Java source line #224	-> byte code offset #93
    //   Java source line #227	-> byte code offset #100
    //   Java source line #229	-> byte code offset #103
    //   Java source line #230	-> byte code offset #124
    //   Java source line #231	-> byte code offset #130
    //   Java source line #232	-> byte code offset #137
    //   Java source line #230	-> byte code offset #151
    //   Java source line #214	-> byte code offset #162
    //   Java source line #237	-> byte code offset #174
    //   Java source line #238	-> byte code offset #176
    //   Java source line #239	-> byte code offset #184
    //   Java source line #238	-> byte code offset #187
    //   Java source line #240	-> byte code offset #195
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	196	0	this	SubscriberDiffTreeEventHandler
    //   0	196	1	events	SubscriberEventHandler.SubscriberEvent[]
    //   0	196	2	monitor	IProgressMonitor
    //   8	158	3	i	int
    //   15	99	4	event	SubscriberEventHandler.SubscriberEvent
    //   57	3	5	se	SubscriberDiffChangedEvent
    //   122	35	5	nodesToRemove	IDiff[]
    //   64	31	6	changedNode	IDiff
    //   125	30	6	j	int
    //   135	7	7	node	IDiff
    //   174	11	8	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	174	174	finally
  }
  
  private void addDiff(IDiff diff, IProgressMonitor monitor)
  {
    if ((filter == null) || (filter.select(diff, monitor))) {
      tree.add(diff);
    } else {
      tree.remove(diff.getPath());
    }
  }
  
  public IResourceDiffTree getTree()
  {
    return tree;
  }
  
  public Subscriber getSubscriber()
  {
    return super.getSubscriber();
  }
  
  public void shutdown()
  {
    state = 8;
    collector.dispose();
    super.shutdown();
  }
  
  protected Object getJobFamiliy()
  {
    return family;
  }
  
  public void setJobFamily(Object family)
  {
    this.family = family;
  }
  
  protected void handleException(CoreException e, IResource resource, int code, String message)
  {
    super.handleException(e, resource, code, message);
    tree.reportError(new TeamStatus(4, "org.eclipse.team.core", code, message, e, resource));
    exceptionState = 2;
  }
  
  protected void handleCancel(OperationCanceledException e)
  {
    super.handleCan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd