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

// Local variable table:
    //   start	length	slot	name	signature
    //   0	74	0	this	SubscriberSyncInfoEventHandler
    //   0	74	1	resource	IResource
    //   0	74	2	depth	int
    //   0	74	3	monitor	IProgressMonitor
    //   18	31	4	collectionMonitor	IProgressMonitor
    //   28	19	5	collectionSet	SyncInfoSet
    //   56	9	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   8	56	56	finally
  }
  
  /* Error */
  protected void dispatchEvents(SubscriberEventHandler.SubscriberEvent[] events, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 189	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler:syncSetInput	Lorg/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber;
    //   4: invokevirtual 220	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber:getSyncSet	()Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   7: astore_3
    //   8: aload_3
    //   9: invokevirtual 215	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:beginInput	()V
    //   12: iconst_0
    //   13: istore 4
    //   15: goto +85 -> 100
    //   18: aload_1
    //   19: iload 4
    //   21: aaload
    //   22: astore 5
    //   24: aload 5
    //   26: invokevirtual 202	org/eclipse/team/internal/core/subscribers/SubscriberEventHandler$SubscriberEvent:getType	()I
    //   29: tableswitch	default:+68->97, 1:+54->83, 2:+23->52
    //   52: aload 5
    //   54: instanceof 100
    //   57: ifeq +40 -> 97
    //   60: aload 5
    //   62: checkcast 100	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$SubscriberSyncInfoEvent
    //   65: astore 6
    //   67: aload_0
    //   68: getfield 189	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler:syncSetInput	Lorg/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber;
    //   71: aload 6
    //   73: invokevirtual 213	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoEventHandler$SubscriberSyncInfoEvent:getResult	()Lorg/eclipse/team/core/synchronize/SyncInfo;
    //   76: aload_2
    //   77: invokevirtual 221	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSubscriber:collect	(Lorg/eclipse/team/core/synchronize/SyncInfo;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   80: goto +17 -> 97
    //   83: aload_3
    //   84: aload 5
    //   86: invokevirtual 203	org/eclipse/team/internal/core/subscribers/SubscriberEventHandler$SubscriberEvent:getResource	()Lorg/eclipse/core/resources/IResource;
    //   89: aload 5
    //   91: invokevirtual 201	org/eclipse/team/internal/core/subscribers/SubscriberEventHandler$SubscriberEvent:getDepth	()I
    //   94: invokevirtual 216	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:remove	(Lorg/eclipse/core/resources/IResource;I)V
    //   97: iinc 4 1
    //   100: iload 4
    //   102: aload_1
    //   103: arraylength
    //   104: if_icmplt -86 -> 18
    //   107: goto +13 -> 120
    //   110: astore 7
    //   112: aload_3
    //   113: aload_2
    //   114: invokevirtual 217	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   117: aload 7
    //   119: athrow
    //   120: aload_3
    //   121: aload_2
    //   122: invokevirtual 217	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   125: return
    // Line number table:
    //   Java source line #174	-> byte code offset #0
    //   Java source line #176	-> byte code offset #8
    //   Java source line #177	-> byte code offset #12
    //   Java source line #178	-> byte code offset #18
    //   Java source line #179	-> byte code offset #24
    //   Java source line #181	-> byte code offset #52
    //   Java source line #182	-> byte code offset #60
    //   Java source line #183	-> byte code offset #67
    //   Java source line #185	-> byte code offset #80
    //   Java source line #187	-> byte code offset #83
    //   Java source line #177	-> byte code offset #97
    //   Java source line #191	-> byte code offset #110
    //   Java source line #192	-> byte code offset #112
    //   Java source line #193	-> byte code offset #117
    //   Java source line #192	-> byte code offset #120
    //   Java source line #194	-> byte code offset #125
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	126	0	this	SubscriberSyncInfoEventHandler
    //   0	126	1	events	SubscriberEventHandler.SubscriberEvent[]
    //   0	126	2	monitor	IProgressMonitor
    //   7	114	3	syncSet	SubscriberSyncInfoSet
    //   13	88	4	i	int
    //   22	68	5	event	SubscriberEventHandler.SubscriberEvent
    //   65	7	6	se	SubscriberSyncInfoEvent
    //   110	8	7	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   8	110	110	finally
  }
  
  public void reset(IResource[] roots)
  {
    RootResourceSynchronizationScope scope = (RootResourceSynchronizationScope)getScope();
    if (roots == null) {
      roots = getSubscriber().roots();
    }
    scope.setRoots(roots);
  }
  
  protected synchronized void reset(ResourceTraversal[] oldTraversals, ResourceTraversal[] newTraversals)
  {
    run(new IWorkspaceRunnable()
    {
      public void run(IProgressMonitor monitor)
        throws CoreException
      {
        syncSetInput.reset(monitor);
      }
    }, false);
    
    super.reset(oldTraversals, newTraversals);
  }
}

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

class SubscriberSyncInfoSet$1
  implements IWorkspaceRunnable
{
  final SubscriberSyncInfoSet this$0;
  private final ISyncInfoSetChangeListener val$listener;
  
  SubscriberSyncInfoSet$1(SubscriberSyncInfoSet paramSubscriberSyncInfoSet, ISyncInfoSetChangeListener paramISyncInfoSetChangeListener)
  {
    this$0 = paramSubscriberSyncInfoSet;val$listener = paramISyncInfoSetChangeListener;
  }
  
  /* Error */
  public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   4: invokevirtual 56	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:beginInput	()V
    //   7: aload_1
    //   8: aconst_null
    //   9: bipush 100
    //   11: invokeinterface 61 3 0
    //   16: aload_0
    //   17: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   20: aload_0
    //   21: getfield 52	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:val$listener	Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;
    //   24: invokevirtual 59	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:removeSyncSetChangedListener	(Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;)V
    //   27: aload_0
    //   28: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   31: aload_0
    //   32: getfield 52	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:val$listener	Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;
    //   35: invokevirtual 58	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:addSyncSetChangedListener	(Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;)V
    //   38: aload_0
    //   39: getfield 52	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:val$listener	Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;
    //   42: aload_0
    //   43: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   46: aload_1
    //   47: bipush 95
    //   49: invokestatic 55	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   52: invokeinterface 62 3 0
    //   57: goto +24 -> 81
    //   60: astore_2
    //   61: aload_0
    //   62: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   65: aload_1
    //   66: iconst_5
    //   67: invokestatic 55	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   70: invokevirtual 57	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   73: aload_1
    //   74: invokeinterface 60 1 0
    //   79: aload_2
    //   80: athrow
    //   81: aload_0
    //   82: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   85: aload_1
    //   86: iconst_5
    //   87: invokestatic 55	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   90: invokevirtual 57	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   93: aload_1
    //   94: invokeinterface 60 1 0
    //   99: return
    // Line number table:
    //   Java source line #66	-> byte code offset #0
    //   Java source line #67	-> byte code offset #7
    //   Java source line #68	-> byte code offset #16
    //   Java source line #69	-> byte code offset #27
    //   Java source line #70	-> byte code offset #38
    //   Java source line #71	-> byte code offset #60
    //   Java source line #72	-> byte code offset #61
    //   Java source line #73	-> byte code offset #73
    //   Java source line #74	-> byte code offset #79
    //   Java source line #72	-> byte code offset #81
    //   Java source line #73	-> byte code offset #93
    //   Java source line #75	-> byte code offset #99
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	100	0	this	1
    //   0	100	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   60	20	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	60	60	finally
  }
}

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

public class SubscriberSyncInfoSet
  extends SyncInfoTree
{
  protected SubscriberEventHandler handler;
  
  public SubscriberSyncInfoSet(SubscriberEventHandler handler)
  {
    this.handler = handler;
  }
  
  public void connect(ISyncInfoSetChangeListener listener, IProgressMonitor monitor)
  {
    if (handler == null) {
      super.connect(listener, monitor);
    } else {
      connect(listener);
    }
  }
  
  public void connect(ISyncInfoSetChangeListener listener)
  {
    if (handler == null) {
      throw new UnsupportedOperationException();
    }
    handler.run(new IWorkspaceRunnable()
    {
      private final ISyncInfoSetChangeListener val$listener;
      
      /* Error */
      public void run(IProgressMonitor monitor)
      {
        // Byte code:
        //   0: aload_0
        //   1: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
        //   4: invokevirtual 56	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:beginInput	()V
        //   7: aload_1
        //   8: aconst_null
        //   9: bipush 100
        //   11: invokeinterface 61 3 0
        //   16: aload_0
        //   17: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
        //   20: aload_0
        //   21: getfield 52	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:val$listener	Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;
        //   24: invokevirtual 59	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:removeSyncSetChangedListener	(Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;)V
        //   27: aload_0
        //   28: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
        //   31: aload_0
        //   32: getfield 52	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:val$listener	Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;
        //   35: invokevirtual 58	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:addSyncSetChangedListener	(Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;)V
        //   38: aload_0
        //   39: getfield 52	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:val$listener	Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;
        //   42: aload_0
        //   43: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
        //   46: aload_1
        //   47: bipush 95
        //   49: invokestatic 55	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
        //   52: invokeinterface 62 3 0
        //   57: goto +24 -> 81
        //   60: astore_2
        //   61: aload_0
        //   62: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
        //   65: aload_1
        //   66: iconst_5
        //   67: invokestatic 55	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
        //   70: invokevirtual 57	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
        //   73: aload_1
        //   74: invokeinterface 60 1 0
        //   79: aload_2
        //   80: athrow
        //   81: aload_0
        //   82: getfield 53	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet$1:this$0	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
        //   85: aload_1
        //   86: iconst_5
        //   87: invokestatic 55	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
        //   90: invokevirtual 57	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
        //   93: aload_1
        //   94: invokeinterface 60 1 0
        //   99: return
        // Line number table:
        //   Java source line #66	-> byte code offset #0
        //   Java source line #67	-> byte code offset #7
        //   Java source line #68	-> byte code offset #16
        //   Java source line #69	-> byte code offset #27
        //   Java source line #70	-> byte code offset #38
        //   Java source line #71	-> byte code offset #60
        //   Java source line #72	-> byte code offset #61
        //   Java source line #73	-> byte code offset #73
        //   Java source line #74	-> byte code offset #79
        //   Java source line #72	-> byte code offset #81
        //   Java source line #73	-> byte code offset #93
        //   Java source line #75	-> byte code offset #99
        // Local variable table:
        //   start	length	slot	name	signature
        //   0	100	0	this	1
        //   0	100	1	monitor	IProgressMonitor
        //   60	20	2	localObject	Object
        // Exception table:
        //   from	to	target	type
        //   0	60	60	finally
      }
    }, true);
  }
}

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

import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.Messages;

public class SyncByteConverter
{
  protected static final byte SEPARATOR_BYTE = 47;
  
  public static byte[] setSlot(byte[] syncBytes, int slot, byte[] newBytes)
    throws TeamException
  {
    int start = startOfSlot(syncBytes, slot);
    if (start == -1) {
      throw new TeamException(NLS.bind(Messages.SyncByteConverter_1, new String[] { new String(syncBytes) }));
    }
    int end = startOfSlot(syncBytes, slot + 1);
    int totalLength = start + 1 + newBytes.length;
    if (end != -1) {
      totalLength += syncBytes.length - end;
    }
    byte[] result = new byte[totalLength];
    System.arraycopy(syncBytes, 0, result, 0, start + 1);
    System.arraycopy(newBytes, 0, result, start + 1, newBytes.length);
    if (end != -1) {
      System.arraycopy(syncBytes, end, result, start + 1 + newBytes.length, syncBytes.length - end);
    }
    return result;
  }
  
  private static int startOfSlot(byte[] syncBytes, int slot)
  {
    int count = 0;
    for (int j = 0; j < syncBytes.length; j++) {
      if (syncBytes[j] == 47)
      {
        count++;
        if (count == slot) {
          return j;
        }
      }
    }
    return -1;
  }
  
  private static int getOffsetOfDelimeter(byte[] bytes, byte delimiter, int start, int n)
  {
    int count = 0;
    for (int i = start; i < bytes.length; i++)
    {
      if (bytes[i] == delimiter) {
        count++;
      }
      if (count == n) {
        return i;
      }
    }
    return -1;
  }
  
  public static byte[] getSlot(byte[] bytes, int index, boolean includeRest)
  {
    byte delimiter = 47;
    int start;
    int start;
    if (index == 0)
    {
      start = -1;
    }
    else
    {
      start = getOffsetOfDelimeter(bytes, delimiter, 0, index);
      if (start == -1) {
        return null;
      }
    }
    int end = getOffsetOfDelimeter(bytes, delimiter, start + 1, 1);
    int length;
    int length;
    if ((end == -1) || (includeRest)) {
      length = bytes.length - start - 1;
    } else {
      length = end - start - 1;
    }
    byte[] result = new byte[length];
    System.arraycopy(bytes, start + 1, result, 0, length);
    return result;
  }
  
  public static byte[] toBytes(String[] slots)
  {
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < slots.length; i++)
    {
      String string = slots[i];
      buffer.append(string);
      buffer.append(new String(new byte[] { 47 }));
    }
    return buffer.toString().getBytes();
  }
}

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

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.eclipse.team.core.synchronize.SyncInfo;

public class SyncInfoStatistics
{
  protected Map stats = new HashMap();
  
  public void add(SyncInfo info)
  {
    Long count = (Long)stats.get(new Integer(info.getKind()));
    if (count == null) {
      count = new Long(0L);
    }
    stats.put(new Integer(info.getKind()), new Long(count.longValue() + 1L));
  }
  
  public void remove(SyncInfo info)
  {
    Integer kind = new Integer(info.getKind());
    Long count = (Long)stats.get(kind);
    if (count != null)
    {
      long newCount = count.intValue() - 1;
      if (newCount > 0L) {
        stats.put(kind, new Long(newCount));
      } else {
        stats.remove(kind);
      }
    }
  }
  
  public long countFor(int kind, int mask)
  {
    if (mask == 0)
    {
      Long count = (Long)stats.get(new Integer(kind));
      return count == null ? 0L : count.longValue();
    }
    Iterator it = stats.keySet().iterator();
    long count = 0L;
    while (it.hasNext())
    {
      Integer key = (Integer)it.next();
      if ((key.intValue() & mask) == kind) {
        count += ((Long)stats.get(key)).intValue();
      }
    }
    return count;
  }
  
  public void clear()
  {
    stats.clear();
  }
  
  public String toString()
  {
    StringBuffer out = new StringBuffer();
    Iterator it = stats.keySet().iterator();
    while (it.hasNext())
    {
      Integer kind = (Integer)it.next();
      out.append(SyncInfo.kindToString(kind.intValue()) + ": " + stats.get(kind) + "\n");
    }
    return out.toString();
  }
}

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

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.core.synchronize.SyncInfoSetChangeEvent;

public class SyncInfoTreeChangeEvent
  extends SyncInfoSetChangeEvent
  implements ISyncInfoTreeChangeEvent
{
  private Set removedSubtrees = new HashSet();
  private Set addedSubtrees = new HashSet();
  
  public SyncInfoTreeChangeEvent(SyncInfoSet set)
  {
    super(set);
  }
  
  public void removedSubtreeRoot(IResource root)
  {
    if (addedSubtrees.contains(root))
    {
      addedSubtrees.remove(root);
    }
    else if (!isDescendantOfAddedRoot(root))
    {
      for (Iterator iter = removedSubtrees.iterator(); iter.hasNext();)
      {
        IResource element = (IResource)iter.next();
        if (root.equals(element)) {
          return;
        }
        if (isParent(root, element)) {
          iter.remove();
        } else if (isParent(element, root)) {
          return;
        }
      }
      removedSubtrees.add(root);
    }
  }
  
  private boolean isParent(IResource root, IResource element)
  {
    return root.getFullPath().isPrefixOf(element.getFullPath());
  }
  
  public void addedSubtreeRoot(IResource parent)
  {
    if (removedSubtrees.contains(parent)) {
      reset();
    } else if (!isDescendantOfAddedRoot(parent)) {
      addedSubtrees.add(parent);
    }
  }
  
  private boolean isDescendantOfAddedRoot(IResource resource)
  {
    for (Iterator iter = addedSubtrees.iterator(); iter.hasNext();)
    {
      IResource root = (IResource)iter.next();
      if (isParent(root, resource)) {
        return true;
      }
    }
    return false;
  }
  
  public IResource[] getAddedSubtreeRoots()
  {
    return (IResource[])addedSubtrees.toArray(new IResource[addedSubtrees.size()]);
  }
  
  public IResource[] getRemovedSubtreeRoots()
  {
    return (IResource[])removedSubtrees.toArray(new IResource[removedSubtrees.size()]);
  }
  
  public boolean isEmpty()
  {
    return (super.isEmpty()) && (removedSubtrees.isEmpty()) && (addedSubtrees.isEmpty());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SyncInfoTreeChangeEvent
 * 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.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.core.TeamPlugin;

public class SyncInfoWorkingSetFilter
  extends FastSyncInfoFilter
{
  private IResource[] resources;
  
  public boolean select(SyncInfo info)
  {
    if (isEmpty()) {
      return true;
    }
    return isIncluded(info.getLocal());
  }
  
  private boolean isIncluded(IResource resource)
  {
    for (int i = 0; i < resources.length; i++)
    {
      IResource setResource = resources[i];
      if (isParent(setResource, resource)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean isParent(IResource parent, IResource child)
  {
    return parent.getFullPath().isPrefixOf(child.getFullPath());
  }
  
  public IResource[] getRoots(Subscriber subscriber)
  {
    IResource[] roots = subscriber.roots();
    if (isEmpty()) {
      return roots;
    }
    Set result = new HashSet();
    for (int i = 0; i < roots.length; i++)
    {
      IResource resource = roots[i];
      result.addAll(Arrays.asList(getIntersectionWithSet(subscriber, resource)));
    }
    return (IResource[])result.toArray(new IResource[result.size()]);
  }
  
  private IResource[] getIntersectionWithSet(Subscriber subscriber, IResource resource)
  {
    List result = new ArrayList();
    for (int i = 0; i < resources.length; i++)
    {
      IResource setResource = resources[i];
      if (setResource != null) {
        if (isParent(resource, setResource)) {
          try
          {
            if (!subscriber.isSupervised(setResource)) {
              continue;
            }
            result.add(setResource);
          }
          catch (TeamException e)
          {
            TeamPlugin.log(e);
            result.add(setResource);
          }
        } else if (isParent(setResource, resource)) {
          result.add(resource);
        }
      }
    }
    return (IResource[])result.toArray(new IResource[result.size()]);
  }
  
  public void setWorkingSet(IResource[] resources)
  {
    this.resources = resources;
  }
  
  public IResource[] getWorkingSet()
  {
    return resources;
  }
  
  private boolean isEmpty()
  {
    return (resources == null) || (resources.length == 0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SyncInfoWorkingSetFilter
 * 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.team.core.TeamException;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoFilter;

public abstract class SyncSetInput
{
  private SubscriberSyncInfoSet syncSet;
  private SyncInfoFilter filter = new FastSyncInfoFilter();
  
  public SyncSetInput(SubscriberEventHandler handler)
  {
    syncSet = new SubscriberSyncInfoSet(handler);
  }
  
  public SubscriberSyncInfoSet getSyncSet()
  {
    return syncSet;
  }
  
  protected abstract void fetchInput(IProgressMonitor paramIProgressMonitor)
    throws TeamException;
  
  public abstract void disconnect();
  
  /* Error */
  public void reset(IProgressMonitor monitor)
    throws TeamException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 90	org/eclipse/team/internal/core/subscribers/SyncSetInput:syncSet	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   4: invokevirtual 97	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:beginInput	()V
    //   7: aload_1
    //   8: invokestatic 95	org/eclipse/team/internal/core/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   11: astore_1
    //   12: aload_1
    //   13: aconst_null
    //   14: bipush 100
    //   16: invokeinterface 106 3 0
    //   21: aload_0
    //   22: getfield 90	org/eclipse/team/internal/core/subscribers/SyncSetInput:syncSet	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   25: invokevirtual 98	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:clear	()V
    //   28: aload_0
    //   29: aload_1
    //   30: bipush 90
    //   32: invokestatic 96	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   35: invokevirtual 104	org/eclipse/team/internal/core/subscribers/SyncSetInput:fetchInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   38: goto +25 -> 63
    //   41: astore_2
    //   42: aload_0
    //   43: getfield 90	org/eclipse/team/internal/core/subscribers/SyncSetInput:syncSet	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   46: aload_1
    //   47: bipush 10
    //   49: invokestatic 96	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   52: invokevirtual 100	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   55: aload_1
    //   56: invokeinterface 105 1 0
    //   61: aload_2
    //   62: athrow
    //   63: aload_0
    //   64: getfield 90	org/eclipse/team/internal/core/subscribers/SyncSetInput:syncSet	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   67: aload_1
    //   68: bipush 10
    //   70: invokestatic 96	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   73: invokevirtual 100	org/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   76: aload_1
    //   77: invokeinterface 105 1 0
    //   82: return
    // Line number table:
    //   Java source line #53	-> byte code offset #0
    //   Java source line #54	-> byte code offset #7
    //   Java source line #55	-> byte code offset #12
    //   Java source line #56	-> byte code offset #21
    //   Java source line #57	-> byte code offset #28
    //   Java source line #58	-> byte code offset #41
    //   Java source line #59	-> byte code offset #42
    //   Java source line #60	-> byte code offset #55
    //   Java source line #61	-> byte code offset #61
    //   Java source line #59	-> byte code offset #63
    //   Java source line #60	-> byte code offset #76
    //   Java source line #62	-> byte code offset #82
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	83	0	this	SyncSetInput
    //   0	83	1	monitor	IProgressMonitor
    //   41	21	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	41	41	finally
  }
  
  protected void collect(SyncInfo info, IProgressMonitor monitor)
  {
    boolean isOutOfSync = filter.select(info, monitor);
    SyncInfo oldInfo = syncSet.getSyncInfo(info.getLocal());
    boolean wasOutOfSync = oldInfo != null;
    if (isOutOfSync) {
      syncSet.add(info);
    } else if (wasOutOfSync) {
      syncSet.remove(info.getLocal());
    }
  }
  
  protected void remove(IResource resource)
  {
    SyncInfo oldInfo = syncSet.getSyncInfo(resource);
    if (oldInfo != null) {
      syncSet.remove(resource);
    }
  }
  
  public SyncInfoFilter getFilter()
  {
    return filter;
  }
  
  public void setFilter(SyncInfoFilter filter)
  {
    this.filter = filter;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.SyncSetInput
 * 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.ITeamStatus;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;

public class SyncSetInputFromSubscriber
  extends SyncSetInput
{
  private Subscriber subscriber;
  
  public SyncSetInputFromSubscriber(Subscriber subscriber, SubscriberEventHandler handler)
  {
    super(handler);
    this.subscriber = subscriber;
  }
  
  public void disconnect() {}
  
  public Subscriber getSubscriber()
  {
    return subscriber;
  }
  
  protected void fetchInput(IProgressMonitor monitor)
    throws TeamException
  {}
  
  public void handleError(ITeamStatus status)
  {
    getSyncSet().addError(status);
  }
}

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

public class SyncSetInputFromSyncSet
  extends SyncSetInput
  implements ISyncInfoSetChangeListener
{
  SubscriberSyncInfoSet inputSyncSet;
  
  public SyncSetInputFromSyncSet(SubscriberSyncInfoSet set, SubscriberEventHandler handler)
  {
    super(handler);
    inputSyncSet = set;
    inputSyncSet.addSyncSetChangedListener(this);
  }
  
  public void disconnect()
  {
    if (inputSyncSet == null) {
      return;
    }
    inputSyncSet.removeSyncSetChangedListener(this);
    inputSyncSet = null;
  }
  
  protected void fetchInput(IProgressMonitor monitor)
  {
    if (inputSyncSet == null) {
      return;
    }
    SyncInfo[] infos = inputSyncSet.getSyncInfos();
    for (int i = 0; i < infos.length; i++) {
      collect(infos[i], monitor);
    }
  }
  
  /* Error */
  public void syncInfoChanged(org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent event, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 122	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:getSyncSet	()Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   4: astore_3
    //   5: aload_3
    //   6: invokevirtual 106	org/eclipse/team/core/synchronize/SyncInfoSet:beginInput	()V
    //   9: aload_2
    //   10: aconst_null
    //   11: bipush 105
    //   13: invokeinterface 126 3 0
    //   18: aload_0
    //   19: aload_1
    //   20: invokeinterface 129 1 0
    //   25: aload_2
    //   26: bipush 50
    //   28: invokestatic 110	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   31: invokespecial 124	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:syncSetChanged	([Lorg/eclipse/team/core/synchronize/SyncInfo;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   34: aload_0
    //   35: aload_1
    //   36: invokeinterface 128 1 0
    //   41: aload_2
    //   42: bipush 50
    //   44: invokestatic 110	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   47: invokespecial 124	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:syncSetChanged	([Lorg/eclipse/team/core/synchronize/SyncInfo;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   50: aload_0
    //   51: aload_1
    //   52: invokeinterface 127 1 0
    //   57: invokespecial 120	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:remove	([Lorg/eclipse/core/resources/IResource;)V
    //   60: goto +17 -> 77
    //   63: astore 4
    //   65: aload_3
    //   66: aload_2
    //   67: iconst_5
    //   68: invokestatic 110	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   71: invokevirtual 108	org/eclipse/team/core/synchronize/SyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   74: aload 4
    //   76: athrow
    //   77: aload_3
    //   78: aload_2
    //   79: iconst_5
    //   80: invokestatic 110	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   83: invokevirtual 108	org/eclipse/team/core/synchronize/SyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   86: return
    // Line number table:
    //   Java source line #53	-> byte code offset #0
    //   Java source line #55	-> byte code offset #5
    //   Java source line #56	-> byte code offset #9
    //   Java source line #57	-> byte code offset #18
    //   Java source line #58	-> byte code offset #34
    //   Java source line #59	-> byte code offset #50
    //   Java source line #60	-> byte code offset #63
    //   Java source line #61	-> byte code offset #65
    //   Java source line #62	-> byte code offset #74
    //   Java source line #61	-> byte code offset #77
    //   Java source line #63	-> byte code offset #86
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	87	0	this	SyncSetInputFromSyncSet
    //   0	87	1	event	org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent
    //   0	87	2	monitor	IProgressMonitor
    //   4	74	3	syncSet	org.eclipse.team.core.synchronize.SyncInfoSet
    //   63	12	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   5	63	63	finally
  }
  
  private void syncSetChanged(SyncInfo[] infos, IProgressMonitor monitor)
  {
    for (int i = 0; i < infos.length; i++) {
      collect(infos[i], monitor);
    }
  }
  
  private void remove(IResource[] resources)
  {
    for (int i = 0; i < resources.length; i++) {
      remove(resources[i]);
    }
  }
  
  public void reset()
  {
    inputSyncSet.connect(this);
  }
  
  /* Error */
  public void syncInfoSetReset(org.eclipse.team.core.synchronize.SyncInfoSet set, IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 105	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:inputSyncSet	Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   4: ifnonnull +11 -> 15
    //   7: aload_1
    //   8: aload_0
    //   9: invokevirtual 109	org/eclipse/team/core/synchronize/SyncInfoSet:removeSyncSetChangedListener	(Lorg/eclipse/team/core/synchronize/ISyncInfoSetChangeListener;)V
    //   12: goto +73 -> 85
    //   15: aload_0
    //   16: invokevirtual 122	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:getSyncSet	()Lorg/eclipse/team/internal/core/subscribers/SubscriberSyncInfoSet;
    //   19: astore_3
    //   20: aload_3
    //   21: invokevirtual 106	org/eclipse/team/core/synchronize/SyncInfoSet:beginInput	()V
    //   24: aload_2
    //   25: aconst_null
    //   26: bipush 100
    //   28: invokeinterface 126 3 0
    //   33: aload_3
    //   34: invokevirtual 107	org/eclipse/team/core/synchronize/SyncInfoSet:clear	()V
    //   37: aload_0
    //   38: aload_2
    //   39: bipush 95
    //   41: invokestatic 110	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   44: invokevirtual 121	org/eclipse/team/internal/core/subscribers/SyncSetInputFromSyncSet:fetchInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   47: goto +23 -> 70
    //   50: astore 4
    //   52: aload_3
    //   53: aload_2
    //   54: iconst_5
    //   55: invokestatic 110	org/eclipse/team/internal/core/Policy:subMoni
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-2017. Infinite Loop Ltd