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

cel(e);
    tree.reportError(new TeamStatus(4, "org.eclipse.team.core", 3, Messages.SubscriberEventHandler_12, e, ResourcesPlugin.getWorkspace().getRoot()));
    if (exceptionState == 0) {
      exceptionState = 1;
    }
  }
  
  public DiffFilter getFilter()
  {
    return filter;
  }
  
  public void setFilter(DiffFilter filter)
  {
    this.filter = filter;
  }
  
  public synchronized void initializeIfNeeded()
  {
    if (state == 1)
    {
      state = 3;
      reset(getScope().getTraversals(), 3);
    }
    else if (exceptionState != 0)
    {
      reset(getScope().getTraversals(), 3);
    }
  }
  
  public synchronized void start()
  {
    super.start();
    if (state == 0) {
      state = 1;
    }
  }
  
  public int getState()
  {
    return state;
  }
  
  protected boolean isSystemJob()
  {
    if ((manager != null) && (!manager.isInitialized())) {
      return false;
    }
    return super.isSystemJob();
  }
  
  public synchronized void remove(IResource resource)
  {
    if (state == 1) {
      return;
    }
    super.remove(resource);
  }
  
  public void change(IResource resource, int depth)
  {
    if (state == 1) {
      return;
    }
    super.change(resource, depth);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler
 * 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.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;

class SubscriberEventHandler$1
  implements ISynchronizationScopeChangeListener
{
  final SubscriberEventHandler this$0;
  
  SubscriberEventHandler$1(SubscriberEventHandler paramSubscriberEventHandler)
  {
    this$0 = paramSubscriberEventHandler;
  }
  
  public void scopeChanged(ISynchronizationScope scope, ResourceMapping[] newMappings, ResourceTraversal[] newTraversals)
  {
    this$0.reset(new ResourceTraversal[0], scope.getTraversals());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberEventHandler.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.resources.mapping.ResourceTraversal;
import org.eclipse.team.internal.core.BackgroundEventHandler.ResourceEvent;

class SubscriberEventHandler$SubscriberEvent
  extends BackgroundEventHandler.ResourceEvent
{
  static final int REMOVAL = 1;
  static final int CHANGE = 2;
  static final int INITIALIZE = 3;
  final SubscriberEventHandler this$0;
  
  SubscriberEventHandler$SubscriberEvent(SubscriberEventHandler paramSubscriberEventHandler, IResource resource, int type, int depth)
  {
    super(resource, type, depth);
    this$0 = paramSubscriberEventHandler;
  }
  
  protected String getTypeString()
  {
    switch (getType())
    {
    case 1: 
      return "REMOVAL";
    case 2: 
      return "CHANGE";
    case 3: 
      return "INITIALIZE";
    }
    return "INVALID";
  }
  
  public ResourceTraversal asTraversal()
  {
    return new ResourceTraversal(new IResource[] { getResource() }, getDepth(), 0);
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.mapping.ResourceMapping;
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.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.core.BackgroundEventHandler;
import org.eclipse.team.internal.core.BackgroundEventHandler.Event;
import org.eclipse.team.internal.core.BackgroundEventHandler.ResourceEvent;
import org.eclipse.team.internal.core.BackgroundEventHandler.RunnableEvent;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.Policy;

public abstract class SubscriberEventHandler
  extends BackgroundEventHandler
{
  private List resultCache = new ArrayList();
  private boolean started = false;
  private boolean initializing = true;
  private IProgressMonitor progressGroup;
  private int ticks;
  private final Subscriber subscriber;
  private ISynchronizationScope scope;
  private ISynchronizationScopeChangeListener scopeChangeListener;
  
  class SubscriberEvent
    extends BackgroundEventHandler.ResourceEvent
  {
    static final int REMOVAL = 1;
    static final int CHANGE = 2;
    static final int INITIALIZE = 3;
    
    SubscriberEvent(IResource resource, int type, int depth)
    {
      super(type, depth);
    }
    
    protected String getTypeString()
    {
      switch (getType())
      {
      case 1: 
        return "REMOVAL";
      case 2: 
        return "CHANGE";
      case 3: 
        return "INITIALIZE";
      }
      return "INVALID";
    }
    
    public ResourceTraversal asTraversal()
    {
      return new ResourceTraversal(new IResource[] { getResource() }, getDepth(), 0);
    }
  }
  
  public SubscriberEventHandler(Subscriber subscriber, ISynchronizationScope scope)
  {
    super(NLS.bind(Messages.SubscriberEventHandler_jobName, new String[] { subscriber.getName() }), NLS.bind(Messages.SubscriberEventHandler_errors, new String[] { subscriber.getName() }));
    this.subscriber = subscriber;
    this.scope = scope;
    scopeChangeListener = new ISynchronizationScopeChangeListener()
    {
      public void scopeChanged(ISynchronizationScope scope, ResourceMapping[] newMappings, ResourceTraversal[] newTraversals)
      {
        reset(new ResourceTraversal[0], scope.getTraversals());
      }
    };
    this.scope.addScopeChangeListener(scopeChangeListener);
  }
  
  protected synchronized void reset(ResourceTraversal[] oldTraversals, ResourceTraversal[] newTraversals)
  {
    reset(newTraversals, 2);
  }
  
  public synchronized void start()
  {
    started = true;
    ResourceTraversal[] traversals = scope.getTraversals();
    reset(traversals, 3);
    initializing = false;
  }
  
  protected synchronized void queueEvent(BackgroundEventHandler.Event event, boolean front)
  {
    if (started) {
      super.queueEvent(event, front);
    }
  }
  
  public void schedule()
  {
    Job job = getEventHandlerJob();
    if (job.getState() == 0) {
      if (progressGroup != null)
      {
        job.setSystem(false);
        job.setProgressGroup(progressGroup, ticks);
      }
      else
      {
        job.setSystem(isSystemJob());
      }
    }
    getEventHandlerJob().schedule();
  }
  
  protected boolean isSystemJob()
  {
    return !initializing;
  }
  
  protected void jobDone(IJobChangeEvent event)
  {
    super.jobDone(event);
    progressGroup = null;
  }
  
  public void change(IResource resource, int depth)
  {
    queueEvent(new SubscriberEvent(resource, 2, depth), false);
  }
  
  public void remove(IResource resource)
  {
    queueEvent(
      new SubscriberEvent(resource, 1, 2), false);
  }
  
  private void collect(IResource resource, int depth, IProgressMonitor monitor)
  {
    Policy.checkCanceled(monitor);
    
    handlePreemptiveEvents(monitor);
    if ((resource.getType() != 1) && 
      (depth != 0)) {
      try
      {
        IResource[] members = 
          getSubscriber().members(resource);
        for (int i = 0; i < members.length; i++) {
          collect(
            members[i], 
            depth == 2 ? 
            2 : 
            0, 
            monitor);
        }
      }
      catch (TeamException e)
      {
        if (resource.getProject().isAccessible()) {
          handleException(e, resource, 2, NLS.bind(Messages.SubscriberEventHandler_8, new String[] { resource.getFullPath().toString(), e.getMessage() }));
        }
      }
    }
    monitor.subTask(NLS.bind(Messages.SubscriberEventHandler_2, new String[] { resource.getFullPath().toString() }));
    try
    {
      handleChange(resource);
      handlePendingDispatch(monitor);
    }
    catch (CoreException e)
    {
      handleException(e, resource, 1, NLS.bind(Messages.SubscriberEventHandler_9, new String[] { resource.getFullPath().toString(), e.getMessage() }));
    }
    monitor.worked(1);
  }
  
  protected Subscriber getSubscriber()
  {
    return subscriber;
  }
  
  protected abstract void handleChange(IResource paramIResource)
    throws CoreException;
  
  protected void handlePendingDispatch(IProgressMonitor monitor)
  {
    if (isReadyForDispatch(false)) {
      try
      {
        dispatchEvents(Policy.subMonitorFor(monitor, 5));
      }
      catch (TeamException e)
      {
        handleException(e, null, 2, e.getMessage());
      }
    }
  }
  
  protected void handleException(CoreException e, IResource resource, int code, String message)
  {
    handleException(e);
  }
  
  protected abstract void collectAll(IResource paramIResource, int paramInt, IProgressMonitor paramIProgressMonitor);
  
  protected abstract void dispatchEvents(SubscriberEvent[] paramArrayOfSubscriberEvent, IProgressMonitor paramIProgressMonitor);
  
  protected void reset(ResourceTraversal[] traversals, int type)
  {
    for (int i = 0; i < traversals.length; i++)
    {
      ResourceTraversal traversal = traversals[i];
      IResource[] resources = traversal.getResources();
      for (int j = 0; j < resources.length; j++) {
        queueEvent(new SubscriberEvent(resources[j], type, traversal.getDepth()), false);
      }
    }
  }
  
  protected void processEvent(BackgroundEventHandler.Event event, IProgressMonitor monitor)
  {
    try
    {
      int type = event.getType();
      switch (type)
      {
      case 1000: 
        executeRunnable(event, monitor);
        break;
      case 1: 
        queueDispatchEvent(event);
        break;
      case 2: 
        collect(
          event.getResource(), 
          ((BackgroundEventHandler.ResourceEvent)event).getDepth(), 
          monitor);
        break;
      case 3: 
        monitor.subTask(NLS.bind(Messages.SubscriberEventHandler_2, new String[] { event.getResource().getFullPath().toString() }));
        collectAll(
          event.getResource(), 
          ((BackgroundEventHandler.ResourceEvent)event).getDepth(), 
          Policy.subMonitorFor(monitor, 64));
      }
    }
    catch (OperationCanceledException e)
    {
      handleCancel(e);
    }
    catch (RuntimeException e)
    {
      if (event.getType() == 1000) {
        handleException(new TeamException(Messages.SubscriberEventHandler_10, e));
      } else {
        handleException(new TeamException(Messages.SubscriberEventHandler_10, e), event.getResource(), 2, NLS.bind(Messages.SubscriberEventHandler_11, new String[] { event.getResource().getFullPath().toString(), e.getMessage() }));
      }
    }
  }
  
  protected void queueDispatchEvent(BackgroundEventHandler.Event event)
  {
    resultCache.add(event);
  }
  
  protected void handleCancel(OperationCanceledException e)
  {
    resultCache.clear();
  }
  
  private void executeRunnable(BackgroundEventHandler.Event event, IProgressMonitor monitor)
  {
    try
    {
      dispatchEvents(Policy.subMonitorFor(monitor, 1));
    }
    catch (TeamException e)
    {
      handleException(e, null, 2, e.getMessage());
    }
    try
    {
      ((BackgroundEventHandler.RunnableEvent)event).run(Policy.subMonitorFor(monitor, 1));
    }
    catch (CoreException e)
    {
      handleException(e, null, 2, e.getMessage());
    }
  }
  
  protected boolean doDispatchEvents(IProgressMonitor monitor)
  {
    if (!resultCache.isEmpty())
    {
      dispatchEvents((SubscriberEvent[])resultCache.toArray(new SubscriberEvent[resultCache.size()]), monitor);
      resultCache.clear();
      return true;
    }
    return false;
  }
  
  public void run(IWorkspaceRunnable runnable, boolean frontOnQueue)
  {
    queueEvent(new BackgroundEventHandler.RunnableEvent(runnable, frontOnQueue), frontOnQueue);
  }
  
  public void setProgressGroupHint(IProgressMonitor progressGroup, int ticks)
  {
    this.progressGroup = progressGroup;
    this.ticks = ticks;
  }
  
  protected void handlePreemptiveEvents(IProgressMonitor monitor)
  {
    BackgroundEventHandler.Event event = peek();
    if (((event instanceof BackgroundEventHandler.RunnableEvent)) && (((BackgroundEventHandler.RunnableEvent)event).isPreemtive())) {
      executeRunnable(nextElement(), monitor);
    }
  }
  
  protected ISynchronizationScope getScope()
  {
    return scope;
  }
  
  public void shutdown()
  {
    super.shutdown();
    scope.removeScopeChangeListener(scopeChangeListener);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberEventHandler
 * 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.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.core.subscribers.ISubscriberChangeListener;
import org.eclipse.team.core.subscribers.Subscriber;

public abstract class SubscriberResourceCollector
  implements IResourceChangeListener, ISubscriberChangeListener
{
  Subscriber subscriber;
  
  public SubscriberResourceCollector(Subscriber subscriber)
  {
    Assert.isNotNull(subscriber);
    this.subscriber = subscriber;
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this, 1);
    subscriber.addListener(this);
  }
  
  public Subscriber getSubscriber()
  {
    return subscriber;
  }
  
  public void dispose()
  {
    getSubscriber().removeListener(this);
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
  }
  
  /* Error */
  public void subscriberResourceChanged(org.eclipse.team.core.subscribers.ISubscriberChangeEvent[] deltas)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 143	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:beginInput	()V
    //   4: aload_0
    //   5: invokevirtual 146	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:getRoots	()[Lorg/eclipse/core/resources/IResource;
    //   8: astore_2
    //   9: iconst_0
    //   10: istore_3
    //   11: goto +134 -> 145
    //   14: aload_1
    //   15: iload_3
    //   16: aaload
    //   17: invokeinterface 165 1 0
    //   22: tableswitch	default:+120->142, 1:+30->52, 2:+84->106, 3:+120->142, 4:+69->91
    //   52: aload_0
    //   53: invokevirtual 145	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:isAllRootsIncluded	()Z
    //   56: ifne +19 -> 75
    //   59: aload_0
    //   60: aload_1
    //   61: iload_3
    //   62: aaload
    //   63: invokeinterface 166 1 0
    //   68: aload_2
    //   69: invokespecial 152	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:isDescendantOfRoot	(Lorg/eclipse/core/resources/IResource;[Lorg/eclipse/core/resources/IResource;)Z
    //   72: ifeq +70 -> 142
    //   75: aload_0
    //   76: aload_1
    //   77: iload_3
    //   78: aaload
    //   79: invokeinterface 166 1 0
    //   84: iconst_0
    //   85: invokevirtual 149	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:change	(Lorg/eclipse/core/resources/IResource;I)V
    //   88: goto +54 -> 142
    //   91: aload_0
    //   92: aload_1
    //   93: iload_3
    //   94: aaload
    //   95: invokeinterface 166 1 0
    //   100: invokevirtual 147	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:remove	(Lorg/eclipse/core/resources/IResource;)V
    //   103: goto +39 -> 142
    //   106: aload_0
    //   107: invokevirtual 145	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:isAllRootsIncluded	()Z
    //   110: ifne +19 -> 129
    //   113: aload_0
    //   114: aload_1
    //   115: iload_3
    //   116: aaload
    //   117: invokeinterface 166 1 0
    //   122: aload_2
    //   123: invokespecial 152	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:isDescendantOfRoot	(Lorg/eclipse/core/resources/IResource;[Lorg/eclipse/core/resources/IResource;)Z
    //   126: ifeq +16 -> 142
    //   129: aload_0
    //   130: aload_1
    //   131: iload_3
    //   132: aaload
    //   133: invokeinterface 166 1 0
    //   138: iconst_2
    //   139: invokevirtual 149	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:change	(Lorg/eclipse/core/resources/IResource;I)V
    //   142: iinc 3 1
    //   145: iload_3
    //   146: aload_1
    //   147: arraylength
    //   148: if_icmplt -134 -> 14
    //   151: goto +12 -> 163
    //   154: astore 4
    //   156: aload_0
    //   157: invokevirtual 144	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:endInput	()V
    //   160: aload 4
    //   162: athrow
    //   163: aload_0
    //   164: invokevirtual 144	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:endInput	()V
    //   167: return
    // Line number table:
    //   Java source line #61	-> byte code offset #0
    //   Java source line #62	-> byte code offset #4
    //   Java source line #63	-> byte code offset #9
    //   Java source line #64	-> byte code offset #14
    //   Java source line #66	-> byte code offset #52
    //   Java source line #67	-> byte code offset #75
    //   Java source line #69	-> byte code offset #88
    //   Java source line #71	-> byte code offset #91
    //   Java source line #72	-> byte code offset #103
    //   Java source line #74	-> byte code offset #106
    //   Java source line #75	-> byte code offset #129
    //   Java source line #63	-> byte code offset #142
    //   Java source line #80	-> byte code offset #154
    //   Java source line #81	-> byte code offset #156
    //   Java source line #82	-> byte code offset #160
    //   Java source line #81	-> byte code offset #163
    //   Java source line #83	-> byte code offset #167
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	168	0	this	SubscriberResourceCollector
    //   0	168	1	deltas	org.eclipse.team.core.subscribers.ISubscriberChangeEvent[]
    //   8	115	2	roots	IResource[]
    //   10	136	3	i	int
    //   154	7	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	154	154	finally
  }
  
  protected void beginInput() {}
  
  protected void endInput() {}
  
  /* Error */
  public void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 143	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:beginInput	()V
    //   4: aload_0
    //   5: aload_1
    //   6: invokeinterface 157 1 0
    //   11: aload_0
    //   12: invokevirtual 146	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:getRoots	()[Lorg/eclipse/core/resources/IResource;
    //   15: invokevirtual 153	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:processDelta	(Lorg/eclipse/core/resources/IResourceDelta;[Lorg/eclipse/core/resources/IResource;)V
    //   18: goto +10 -> 28
    //   21: astore_2
    //   22: aload_0
    //   23: invokevirtual 144	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:endInput	()V
    //   26: aload_2
    //   27: athrow
    //   28: aload_0
    //   29: invokevirtual 144	org/eclipse/team/internal/core/subscribers/SubscriberResourceCollector:endInput	()V
    //   32: return
    // Line number table:
    //   Java source line #110	-> byte code offset #0
    //   Java source line #111	-> byte code offset #4
    //   Java source line #112	-> byte code offset #21
    //   Java source line #113	-> byte code offset #22
    //   Java source line #114	-> byte code offset #26
    //   Java source line #113	-> byte code offset #28
    //   Java source line #115	-> byte code offset #32
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	33	0	this	SubscriberResourceCollector
    //   0	33	1	event	org.eclipse.core.resources.IResourceChangeEvent
    //   21	6	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	21	21	finally
  }
  
  protected void processDelta(IResourceDelta delta, IResource[] roots)
  {
    IResource resource = delta.getResource();
    int kind = delta.getKind();
    if (resource.getType() == 4) {
      if (((kind & 0x2) != 0) || 
        (((delta.getFlags() & 0x4000) != 0) && (!((IProject)resource).isOpen())) || 
        (!isAncestorOfRoot(resource, roots))) {
        if (hasMembers(resource)) {
          remove(resource);
        }
      }
    }
    boolean visitChildren = false;
    if (isDescendantOfRoot(resource, roots))
    {
      visitChildren = true;
      if ((delta.getFlags() & 0x8000) != 0)
      {
        remove(resource);
        change(resource, 2);
      }
      int changeFlags = delta.getFlags();
      if ((changeFlags & 0x4100) != 0) {
        change(resource, 0);
      }
      if ((delta.getKind() & 0x3) != 0) {
        change(resource, 0);
      }
    }
    if ((visitChildren) || (isAncestorOfRoot(resource, roots)))
    {
      IResourceDelta[] affectedChildren = delta.getAffectedChildren(7);
      for (int i = 0; i < affectedChildren.length; i++) {
        processDelta(affectedChildren[i], roots);
      }
    }
  }
  
  protected IResource[] getRoots()
  {
    return getSubscriber().roots();
  }
  
  protected abstract boolean hasMembers(IResource paramIResource);
  
  protected abstract void remove(IResource paramIResource);
  
  protected abstract void change(IResource paramIResource, int paramInt);
  
  protected boolean isAllRootsIncluded()
  {
    return true;
  }
  
  private boolean isAncestorOfRoot(IResource parent, IResource[] roots)
  {
    if (parent.getType() == 8) {
      return true;
    }
    for (int i = 0; i < roots.length; i++)
    {
      IResource resource = roots[i];
      if (parent.getFullPath().isPrefixOf(resource.getFullPath())) {
        return true;
      }
    }
    return false;
  }
  
  private boolean isDescendantOfRoot(IResource resource, IResource[] roots)
  {
    for (int i = 0; i < roots.length; i++)
    {
      IResource root = roots[i];
      if (root.getFullPath().isPrefixOf(resource.getFullPath())) {
        return true;
      }
    }
    return false;
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoFilter;

class SubscriberSyncInfoCollector$1
  extends SyncInfoFilter
{
  final SubscriberSyncInfoCollector this$0;
  
  SubscriberSyncInfoCollector$1(SubscriberSyncInfoCollector paramSubscriberSyncInfoCollector)
  {
    this$0 = paramSubscriberSyncInfoCollector;
  }
  
  public boolean select(SyncInfo info, IProgressMonitor monitor)
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoCollector.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.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.core.Policy;

public final class SubscriberSyncInfoCollector
  extends SubscriberResourceCollector
{
  private final SyncSetInputFromSubscriber subscriberInput;
  private SyncSetInputFromSyncSet filteredInput;
  private SubscriberSyncInfoEventHandler eventHandler;
  private IResource[] roots;
  
  public SubscriberSyncInfoCollector(Subscriber subscriber, IResource[] roots)
  {
    super(subscriber);
    this.roots = roots;
    eventHandler = new SubscriberSyncInfoEventHandler(subscriber, roots);
    subscriberInput = eventHandler.getSyncSetInput();
    filteredInput = new SyncSetInputFromSyncSet(subscriberInput.getSyncSet(), getEventHandler());
    filteredInput.setFilter(new SyncInfoFilter()
    {
      public boolean select(SyncInfo info, IProgressMonitor monitor)
      {
        return true;
      }
    });
  }
  
  public void setProgressGroup(IProgressMonitor monitor, int ticks)
  {
    getEventHandler().setProgressGroupHint(monitor, ticks);
  }
  
  public void start()
  {
    eventHandler.start();
  }
  
  public void waitForCollector(IProgressMonitor monitor)
  {
    monitor.worked(1);
    int i = 0;
    do
    {
      try
      {
        Thread.sleep(5L);
      }
      catch (InterruptedException localInterruptedException) {}
      Policy.checkCanceled(monitor);
      
      i = eventHandler.getEventHandlerJob().getState() == 0 ? i + 1 : 0;
    } while (i != 50);
    monitor.worked(1);
  }
  
  public void reset()
  {
    eventHandler.reset(getRoots());
  }
  
  public void dispose()
  {
    eventHandler.shutdown();
    subscriberInput.disconnect();
    if (filteredInput != null) {
      filteredInput.disconnect();
    }
    super.dispose();
  }
  
  public IResource[] getRoots()
  {
    if (roots == null) {
      return super.getRoots();
    }
    return roots;
  }
  
  public boolean isAllRootsIncluded()
  {
    return roots == null;
  }
  
  protected SubscriberEventHandler getEventHandler()
  {
    return eventHandler;
  }
  
  public SyncInfoTree getSubscriberSyncInfoSet()
  {
    return subscriberInput.getSyncSet();
  }
  
  public SyncInfoTree getSyncInfoSet()
  {
    return filteredInput.getSyncSet();
  }
  
  public void setFilter(SyncInfoFilter filter)
  {
    filteredInput.setFilter(filter);
    filteredInput.reset();
  }
  
  public void setRoots(IResource[] roots)
  {
    this.roots = roots;
    reset();
  }
  
  protected boolean hasMembers(IResource resource)
  {
    return getSubscriberSyncInfoSet().hasMembers(resource);
  }
  
  protected void remove(IResource resource)
  {
    eventHandler.remove(resource);
  }
  
  protected void change(IResource resource, int depth)
  {
    eventHandler.change(resource, depth);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;

class SubscriberSyncInfoEventHandler$1
  extends SubProgressMonitor
{
  boolean dispatching;
  final SubscriberSyncInfoEventHandler this$0;
  
  SubscriberSyncInfoEventHandler$1(SubscriberSyncInfoEventHandler paramSubscriberSyncInfoEventHandler, IProgressMonitor $anonymous0, int $anonymous1)
  {
    super($anonymous0, $anonymous1);this$0 = paramSubscriberSyncInfoEventHandler;
    dispatching = false;
  }
  
  public void subTask(String name)
  {
    dispatch();
    super.subTask(name);
  }
  
  /* Error */
  private void dispatch()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 41	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:dispatching	Z
    //   4: ifeq +4 -> 8
    //   7: return
    //   8: aload_0
    //   9: iconst_1
    //   10: putfield 41	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:dispatching	Z
    //   13: aload_0
    //   14: getfield 42	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler;
    //   17: aload_0
    //   18: invokevirtual 47	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler:handlePreemptiveEvents	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   21: aload_0
    //   22: getfield 42	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler;
    //   25: aload_0
    //   26: invokevirtual 46	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler:handlePendingDispatch	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   29: goto +11 -> 40
    //   32: astore_1
    //   33: aload_0
    //   34: iconst_0
    //   35: putfield 41	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:dispatching	Z
    //   38: aload_1
    //   39: athrow
    //   40: aload_0
    //   41: iconst_0
    //   42: putfield 41	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:dispatching	Z
    //   45: return
    // Line number table:
    //   Java source line #119	-> byte code offset #0
    //   Java source line #121	-> byte code offset #8
    //   Java source line #122	-> byte code offset #13
    //   Java source line #123	-> byte code offset #21
    //   Java source line #124	-> byte code offset #32
    //   Java source line #125	-> byte code offset #33
    //   Java source line #126	-> byte code offset #38
    //   Java source line #125	-> byte code offset #40
    //   Java source line #127	-> byte code offset #45
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	46	0	this	1
    //   32	7	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   8	32	32	finally
  }
  
  public void worked(int work)
  {
    dispatch();
    super.worked(work);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoEventHandler.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.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.ILog;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.TeamStatus;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.TeamPlugin;

class SubscriberSyncInfoEventHandler$2
  extends SyncInfoSet
{
  final SubscriberSyncInfoEventHandler this$0;
  
  SubscriberSyncInfoEventHandler$2(SubscriberSyncInfoEventHandler paramSubscriberSyncInfoEventHandler)
  {
    this$0 = paramSubscriberSyncInfoEventHandler;
  }
  
  public void add(SyncInfo info)
  {
    super.add(info);
    this$0.queueDispatchEvent(
      new SubscriberSyncInfoEventHandler.SubscriberSyncInfoEvent(this$0, info.getLocal(), 2, 0, info));
  }
  
  public void addError(ITeamStatus status)
  {
    if ((status instanceof TeamStatus))
    {
      TeamStatus ts = (TeamStatus)status;
      IResource resource = ts.getResource();
      if ((resource != null) && (!resource.getProject().isAccessible())) {
        return;
      }
    }
    super.addError(status);
    TeamPlugin.getPlugin().getLog().log(status);
    SubscriberSyncInfoEventHandler.access$0(this$0).handleError(status);
  }
  
  public void remove(IResource resource)
  {
    super.remove(resource);
    this$0.queueDispatchEvent(
      new SubscriberEventHandler.SubscriberEvent(this$0, resource, 1, 0));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoEventHandler.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.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

class SubscriberSyncInfoEventHandler$3
  implements IWorkspaceRunnable
{
  final SubscriberSyncInfoEventHandler this$0;
  
  SubscriberSyncInfoEventHandler$3(SubscriberSyncInfoEventHandler paramSubscriberSyncInfoEventHandler)
  {
    this$0 = paramSubscriberSyncInfoEventHandler;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    SubscriberSyncInfoEventHandler.access$0(this$0).reset(monitor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoEventHandler.3
 * 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.synchronize.SyncInfo;

class SubscriberSyncInfoEventHandler$SubscriberSyncInfoEvent
  extends SubscriberEventHandler.SubscriberEvent
{
  private final SyncInfo result;
  final SubscriberSyncInfoEventHandler this$0;
  
  public SubscriberSyncInfoEventHandler$SubscriberSyncInfoEvent(SubscriberSyncInfoEventHandler paramSubscriberSyncInfoEventHandler, IResource resource, int type, int depth, SyncInfo result)
  {
    super(paramSubscriberSyncInfoEventHandler, resource, type, depth);this$0 = paramSubscriberSyncInfoEventHandler;
    this.result = result;
  }
  
  public SyncInfo getResult()
  {
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SubscriberSyncInfoEventHandler.SubscriberSyncInfoEvent
 * 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.IProject;
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.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.TeamStatus;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.TeamPlugin;

public class SubscriberSyncInfoEventHandler
  extends SubscriberEventHandler
{
  private final SyncSetInputFromSubscriber syncSetInput;
  
  private class SubscriberSyncInfoEvent
    extends SubscriberEventHandler.SubscriberEvent
  {
    private final SyncInfo result;
    
    public SubscriberSyncInfoEvent(IResource resource, int type, int depth, SyncInfo result)
    {
      super(resource, type, depth);
      this.result = result;
    }
    
    public SyncInfo getResult()
    {
      return result;
    }
  }
  
  public static ISynchronizationScope createScope(IResource[] roots, Subscriber subscriber)
  {
    if (roots == null) {
      roots = subscriber.roots();
    }
    return new RootResourceSynchronizationScope(roots);
  }
  
  public SubscriberSyncInfoEventHandler(Subscriber subscriber, IResource[] roots)
  {
    super(subscriber, createScope(roots, subscriber));
    syncSetInput = new SyncSetInputFromSubscriber(subscriber, this);
  }
  
  protected void handleException(CoreException e, IResource resource, int code, String message)
  {
    super.handleException(e, resource, code, message);
    syncSetInput.handleError(new TeamStatus(4, "org.eclipse.team.core", code, message, e, resource));
  }
  
  protected void handleCancel(OperationCanceledException e)
  {
    super.handleCancel(e);
    syncSetInput.handleError(new TeamStatus(4, "org.eclipse.team.core", 3, Messages.SubscriberEventHandler_12, e, ResourcesPlugin.getWorkspace().getRoot()));
  }
  
  public SyncSetInputFromSubscriber getSyncSetInput()
  {
    return syncSetInput;
  }
  
  protected void handleChange(IResource resource)
    throws TeamException
  {
    SyncInfo info = syncSetInput.getSubscriber().getSyncInfo(resource);
    if (info == null) {
      queueDispatchEvent(
        new SubscriberEventHandler.SubscriberEvent(this, resource, 1, 0));
    } else {
      queueDispatchEvent(
        new SubscriberSyncInfoEvent(resource, 2, 0, info));
    }
  }
  
  /* Error */
  protected void collectAll(IResource resource, int depth, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_3
    //   1: aconst_null
    //   2: iconst_m1
    //   3: invokeinterface 225 3 0
    //   8: new 97	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1
    //   11: dup
    //   12: aload_0
    //   13: aload_3
    //   14: iconst_m1
    //   15: invokespecial 210	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$1:<init>	(Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler;Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   18: astore 4
    //   20: new 98	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$2
    //   23: dup
    //   24: aload_0
    //   25: invokespecial 211	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$2:<init>	(Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler;)V
    //   28: astore 5
    //   30: aload_0
    //   31: getfield 189	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler:syncSetInput	Lorg/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber;
    //   34: invokevirtual 219	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber:getSubscriber	()Lorg/eclipse/team/core/subscribers/Subscriber;
    //   37: iconst_1
    //   38: anewarray 83	org/eclipse/core/resources/IResource
    //   41: dup
    //   42: iconst_0
    //   43: aload_1
    //   44: aastore
    //   45: iload_2
    //   46: aload 5
    //   48: aload 4
    //   50: invokevirtual 194	org/eclipse/team/core/subscribers/Subscriber:collectOutOfSync	([Lorg/eclipse/core/resources/IResource;ILorg/eclipse/team/core/synchronize/SyncInfoSet;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   53: goto +14 -> 67
    //   56: astore 6
    //   58: aload_3
    //   59: invokeinterface 224 1 0
    //   64: aload 6
    //   66: athrow
    //   67: aload_3
    //   68: invokeinterface 224 1 0
    //   73: return
    // Line number table:
    //   Java source line #108	-> byte code offset #0
    //   Java source line #112	-> byte code offset #8
    //   Java source line #135	-> byte code offset #20
    //   Java source line #162	-> byte code offset #30
    //   Java source line #164	-> byte code offset #56
    //   Java source line #165	-> byte code offset #58
    //   Java source line #166	-> byte code offset #64
    //   Java source line #165	-> byte code offset #67
    //   Java source line #167	-> byte code offset #73
    
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