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

ddScopeChangeListener(ISynchronizationScopeChangeListener listener)
  {
    listeners.add(listener);
  }
  
  public void removeScopeChangeListener(ISynchronizationScopeChangeListener listener)
  {
    listeners.remove(listener);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.AbstractSynchronizationScope
 * 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.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.team.core.diff.IDiff;
import org.osgi.service.prefs.Preferences;

public class ActiveChangeSet
  extends DiffChangeSet
{
  private static final String CTX_TITLE = "title";
  private static final String CTX_COMMENT = "comment";
  private static final String CTX_RESOURCES = "resources";
  private static final String CTX_USER_CREATED = "userCreated";
  private final ActiveChangeSetManager manager;
  private String comment;
  private boolean userCreated = true;
  
  public ActiveChangeSet(ActiveChangeSetManager manager, String title)
  {
    super(title);
    this.manager = manager;
  }
  
  public String getTitle()
  {
    return getName();
  }
  
  public void setTitle(String title)
  {
    setName(title);
    getManager().fireNameChangedEvent(this);
  }
  
  public String getComment()
  {
    if (comment == null) {
      return getTitle();
    }
    return comment;
  }
  
  public void setComment(String comment)
  {
    if ((comment != null) && (comment.equals(getTitle()))) {
      this.comment = null;
    } else {
      this.comment = comment;
    }
  }
  
  protected boolean isValidChange(IDiff diff)
  {
    return getManager().isModified(diff);
  }
  
  private void addResource(IResource resource)
    throws CoreException
  {
    IDiff diff = getManager().getDiff(resource);
    if (diff != null) {
      add(diff);
    }
  }
  
  private ActiveChangeSetManager getManager()
  {
    return manager;
  }
  
  public boolean hasComment()
  {
    return comment != null;
  }
  
  public void save(Preferences prefs)
  {
    prefs.put("title", getTitle());
    if (comment != null) {
      prefs.put("comment", comment);
    }
    if (!isEmpty())
    {
      StringBuffer buffer = new StringBuffer();
      IResource[] resources = getResources();
      for (int i = 0; i < resources.length; i++)
      {
        IResource resource = resources[i];
        buffer.append(resource.getFullPath().toString());
        buffer.append('\n');
      }
      prefs.put("resources", buffer.toString());
    }
    prefs.putBoolean("userCreated", isUserCreated());
  }
  
  /* Error */
  public void init(Preferences prefs)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: ldc 5
    //   4: ldc 1
    //   6: invokeinterface 275 3 0
    //   11: invokevirtual 249	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:setName	(Ljava/lang/String;)V
    //   14: aload_0
    //   15: aload_1
    //   16: ldc 3
    //   18: aconst_null
    //   19: invokeinterface 275 3 0
    //   24: putfield 224	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:comment	Ljava/lang/String;
    //   27: aload_1
    //   28: ldc 4
    //   30: aconst_null
    //   31: invokeinterface 275 3 0
    //   36: astore_2
    //   37: aload_2
    //   38: ifnull +124 -> 162
    //   41: aload_0
    //   42: invokevirtual 254	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:internalGetDiffTree	()Lorg/eclipse/team/core/mapping/provider/ResourceDiffTree;
    //   45: astore_3
    //   46: aload_3
    //   47: invokevirtual 242	org/eclipse/team/core/mapping/provider/ResourceDiffTree:beginInput	()V
    //   50: invokestatic 238	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   53: invokeinterface 266 1 0
    //   58: astore 4
    //   60: new 114	java/util/StringTokenizer
    //   63: dup
    //   64: aload_2
    //   65: ldc 2
    //   67: invokespecial 237	java/util/StringTokenizer:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   70: astore 5
    //   72: goto +64 -> 136
    //   75: aload 5
    //   77: invokevirtual 236	java/util/StringTokenizer:nextToken	()Ljava/lang/String;
    //   80: astore 6
    //   82: aload 6
    //   84: invokevirtual 229	java/lang/String:trim	()Ljava/lang/String;
    //   87: invokevirtual 226	java/lang/String:length	()I
    //   90: ifle +46 -> 136
    //   93: aload_0
    //   94: aload 4
    //   96: aload 6
    //   98: invokespecial 256	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:getResource	(Lorg/eclipse/core/resources/IWorkspaceRoot;Ljava/lang/String;)Lorg/eclipse/core/resources/IResource;
    //   101: astore 7
    //   103: aload 7
    //   105: ifnull +31 -> 136
    //   108: aload_0
    //   109: invokespecial 255	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:getManager	()Lorg/eclipse/team/internal/core/subscribers/ActiveChangeSetManager;
    //   112: aload 7
    //   114: invokevirtual 259	org/eclipse/team/internal/core/subscribers/ActiveChangeSetManager:getDiff	(Lorg/eclipse/core/resources/IResource;)Lorg/eclipse/team/core/diff/IDiff;
    //   117: ifnull +19 -> 136
    //   120: aload_0
    //   121: aload 7
    //   123: invokespecial 251	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:addResource	(Lorg/eclipse/core/resources/IResource;)V
    //   126: goto +10 -> 136
    //   129: astore 8
    //   131: aload 8
    //   133: invokestatic 244	org/eclipse/team/internal/core/TeamPlugin:log	(Lorg/eclipse/core/runtime/CoreException;)V
    //   136: aload 5
    //   138: invokevirtual 235	java/util/StringTokenizer:hasMoreTokens	()Z
    //   141: ifne -66 -> 75
    //   144: goto +13 -> 157
    //   147: astore 9
    //   149: aload_3
    //   150: aconst_null
    //   151: invokevirtual 243	org/eclipse/team/core/mapping/provider/ResourceDiffTree:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   154: aload 9
    //   156: athrow
    //   157: aload_3
    //   158: aconst_null
    //   159: invokevirtual 243	org/eclipse/team/core/mapping/provider/ResourceDiffTree:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   162: aload_0
    //   163: aload_1
    //   164: ldc 6
    //   166: iconst_1
    //   167: invokeinterface 273 3 0
    //   172: putfield 223	org/eclipse/team/internal/core/subscribers/ActiveChangeSet:userCreated	Z
    //   175: return
    // Line number table:
    //   Java source line #141	-> byte code offset #0
    //   Java source line #142	-> byte code offset #14
    //   Java source line #143	-> byte code offset #27
    //   Java source line #144	-> byte code offset #37
    //   Java source line #145	-> byte code offset #41
    //   Java source line #147	-> byte code offset #46
    //   Java source line #148	-> byte code offset #50
    //   Java source line #149	-> byte code offset #60
    //   Java source line #150	-> byte code offset #72
    //   Java source line #151	-> byte code offset #75
    //   Java source line #152	-> byte code offset #82
    //   Java source line #153	-> byte code offset #93
    //   Java source line #156	-> byte code offset #103
    //   Java source line #157	-> byte code offset #120
    //   Java source line #159	-> byte code offset #129
    //   Java source line #160	-> byte code offset #131
    //   Java source line #150	-> byte code offset #136
    //   Java source line #164	-> byte code offset #147
    //   Java source line #165	-> byte code offset #149
    //   Java source line #166	-> byte code offset #154
    //   Java source line #165	-> byte code offset #157
    //   Java source line #168	-> byte code offset #162
    //   Java source line #169	-> byte code offset #175
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	176	0	this	ActiveChangeSet
    //   0	176	1	prefs	Preferences
    //   36	29	2	resourcePaths	String
    //   45	113	3	tree	org.eclipse.team.core.mapping.provider.ResourceDiffTree
    //   58	37	4	root	IWorkspaceRoot
    //   70	67	5	tokenizer	java.util.StringTokenizer
    //   80	17	6	next	String
    //   101	21	7	resource	IResource
    //   129	3	8	e	CoreException
    //   147	8	9	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   103	126	129	org/eclipse/core/runtime/CoreException
    //   46	147	147	finally
  }
  
  private IResource getResource(IWorkspaceRoot root, String next)
  {
    IResource resource = root.findMember(next);
    if (resource == null)
    {
      Path path = new Path(null, next);
      if (next.charAt(next.length() - 1) == '/')
      {
        if (path.segmentCount() == 1) {
          resource = root.getProject(path.lastSegment());
        } else {
          resource = root.getFolder(path);
        }
      }
      else {
        resource = root.getFile(path);
      }
    }
    return resource;
  }
  
  public void add(IResource[] resources)
    throws CoreException
  {
    List toAdd = new ArrayList();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      IDiff diff = getManager().getDiff(resource);
      if (diff != null) {
        toAdd.add(diff);
      }
    }
    if (!toAdd.isEmpty()) {
      add((IDiff[])toAdd.toArray(new IDiff[toAdd.size()]));
    }
  }
  
  public void setUserCreated(boolean userCreated)
  {
    this.userCreated = userCreated;
  }
  
  public boolean isUserCreated()
  {
    return userCreated;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.ActiveChangeSet
 * 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.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
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.IDiffChangeEvent;
import org.eclipse.team.core.diff.IDiffChangeListener;
import org.eclipse.team.core.diff.IDiffTree;
import org.eclipse.team.core.diff.IThreeWayDiff;
import org.eclipse.team.core.mapping.IChangeGroupingRequestor;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.TeamPlugin;
import org.eclipse.team.internal.core.mapping.CompoundResourceTraversal;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;

public abstract class ActiveChangeSetManager
  extends ChangeSetManager
  implements IDiffChangeListener, IChangeGroupingRequestor
{
  private static final String CTX_DEFAULT_SET = "defaultSet";
  private ActiveChangeSet defaultSet;
  
  protected ChangeSet getChangeSet(IResourceDiffTree tree)
  {
    ChangeSet[] sets = getSets();
    for (int i = 0; i < sets.length; i++)
    {
      ChangeSet changeSet = sets[i];
      if (((DiffChangeSet)changeSet).getDiffTree() == tree) {
        return changeSet;
      }
    }
    return null;
  }
  
  public void add(ChangeSet set)
  {
    Assert.isTrue(set instanceof ActiveChangeSet);
    super.add(set);
  }
  
  protected void handleSetAdded(ChangeSet set)
  {
    Assert.isTrue(set instanceof ActiveChangeSet);
    ((DiffChangeSet)set).getDiffTree().addDiffChangeListener(getDiffTreeListener());
    super.handleSetAdded(set);
    handleAddedResources(set, ((ActiveChangeSet)set).internalGetDiffTree().getDiffs());
  }
  
  protected void handleSetRemoved(ChangeSet set)
  {
    ((DiffChangeSet)set).getDiffTree().removeDiffChangeListener(getDiffTreeListener());
    super.handleSetRemoved(set);
  }
  
  protected IDiffChangeListener getDiffTreeListener()
  {
    return this;
  }
  
  public void diffsChanged(IDiffChangeEvent event, IProgressMonitor monitor)
  {
    IResourceDiffTree tree = (IResourceDiffTree)event.getTree();
    handleSyncSetChange(tree, event.getAdditions(), getAllResources(event));
  }
  
  public void propertyChanged(IDiffTree tree, int property, IPath[] paths) {}
  
  public boolean isModified(IFile file)
    throws CoreException
  {
    IDiff diff = getDiff(file);
    if (diff != null) {
      return isModified(diff);
    }
    return false;
  }
  
  public boolean isModified(IDiff diff)
  {
    if (diff != null)
    {
      if ((diff instanceof IThreeWayDiff))
      {
        IThreeWayDiff twd = (IThreeWayDiff)diff;
        int dir = twd.getDirection();
        return (dir == 256) || (dir == 768);
      }
      return diff.getKind() != 0;
    }
    return false;
  }
  
  public ActiveChangeSet getSet(String name)
  {
    ChangeSet[] sets = getSets();
    for (int i = 0; i < sets.length; i++)
    {
      ChangeSet set = sets[i];
      if ((set.getName().equals(name)) && ((set instanceof ActiveChangeSet))) {
        return (ActiveChangeSet)set;
      }
    }
    return null;
  }
  
  public ActiveChangeSet createSet(String title, IFile[] files)
    throws CoreException
  {
    List infos = new ArrayList();
    for (int i = 0; i < files.length; i++)
    {
      IFile file = files[i];
      IDiff diff = getDiff(file);
      if (diff != null) {
        infos.add(diff);
      }
    }
    return createSet(title, (IDiff[])infos.toArray(new IDiff[infos.size()]));
  }
  
  public ActiveChangeSet createSet(String title, IDiff[] diffs)
  {
    ActiveChangeSet commitSet = doCreateSet(title);
    if ((diffs != null) && (diffs.length > 0)) {
      commitSet.add(diffs);
    }
    return commitSet;
  }
  
  protected ActiveChangeSet doCreateSet(String name)
  {
    return new ActiveChangeSet(this, name);
  }
  
  public abstract IDiff getDiff(IResource paramIResource)
    throws CoreException;
  
  protected boolean isSingleSetPerResource()
  {
    return true;
  }
  
  private IPath[] getAllResources(IDiffChangeEvent event)
  {
    Set allResources = new HashSet();
    IDiff[] addedResources = event.getAdditions();
    for (int i = 0; i < addedResources.length; i++)
    {
      IDiff diff = addedResources[i];
      allResources.add(diff.getPath());
    }
    IDiff[] changedResources = event.getChanges();
    for (int i = 0; i < changedResources.length; i++)
    {
      IDiff diff = changedResources[i];
      allResources.add(diff.getPath());
    }
    IPath[] removals = event.getRemovals();
    for (int i = 0; i < removals.length; i++)
    {
      IPath path = removals[i];
      allResources.add(path);
    }
    return (IPath[])allResources.toArray(new IPath[allResources.size()]);
  }
  
  protected void handleAddedResources(ChangeSet set, IDiff[] diffs)
  {
    if ((isSingleSetPerResource()) && (((ActiveChangeSet)set).isUserCreated()))
    {
      IResource[] resources = new IResource[diffs.length];
      for (int i = 0; i < resources.length; i++) {
        resources[i] = ((DiffChangeSet)set).getDiffTree().getResource(diffs[i]);
      }
      ChangeSet[] sets = getSets();
      for (int i = 0; i < sets.length; i++)
      {
        ChangeSet otherSet = sets[i];
        if ((otherSet != set) && (((ActiveChangeSet)otherSet).isUserCreated())) {
          otherSet.remove(resources);
        }
      }
    }
  }
  
  private void handleSyncSetChange(IResourceDiffTree tree, IDiff[] addedDiffs, IPath[] allAffectedResources)
  {
    ChangeSet changeSet = getChangeSet(tree);
    if ((tree.isEmpty()) && (changeSet != null)) {
      remove(changeSet);
    }
    fireResourcesChangedEvent(changeSet, allAffectedResources);
    handleAddedResources(changeSet, addedDiffs);
  }
  
  public void makeDefault(ActiveChangeSet set)
  {
    if ((set != null) && (!contains(set))) {
      add(set);
    }
    ActiveChangeSet oldSet = defaultSet;
    defaultSet = set;
    fireDefaultChangedEvent(oldSet, defaultSet);
  }
  
  public boolean isDefault(ActiveChangeSet set)
  {
    return set == defaultSet;
  }
  
  public ActiveChangeSet getDefaultSet()
  {
    return defaultSet;
  }
  
  public ResourceTraversal[] adjustInputTraversals(ResourceTraversal[] traversals)
  {
    CompoundResourceTraversal traversal = new CompoundResourceTraversal();
    traversal.addTraversals(traversals);
    ChangeSet[] sets = getSets();
    for (int i = 0; i < sets.length; i++)
    {
      ChangeSet set = sets[i];
      handleIntersect(traversal, set);
    }
    return traversal.asTraversals();
  }
  
  private void handleIntersect(CompoundResourceTraversal traversal, ChangeSet set)
  {
    IResource[] resources = set.getResources();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      if (traversal.isCovered(resource, 0))
      {
        traversal.addResources(resources, 0);
        return;
      }
    }
  }
  
  protected void save(Preferences prefs)
  {
    if (!isInitialized()) {
      return;
    }
    try
    {
      String[] oldSetNames = prefs.childrenNames();
      for (int i = 0; i < oldSetNames.length; i++)
      {
        String string = oldSetNames[i];
        prefs.node(string).removeNode();
      }
    }
    catch (BackingStoreException e)
    {
      TeamPlugin.log(4, NLS.bind(Messages.SubscriberChangeSetCollector_5, new String[] { getName() }), e);
    }
    ChangeSet[] sets = getSets();
    for (int i = 0; i < sets.length; i++)
    {
      ChangeSet set = sets[i];
      if (((set instanceof ActiveChangeSet)) && (!set.isEmpty()))
      {
        String childPrefName = escapePrefName(((ActiveChangeSet)set).getTitle());
        Preferences child = prefs.node(childPrefName);
        ((ActiveChangeSet)set).save(child);
      }
    }
    if (getDefaultSet() != null) {
      prefs.put("defaultSet", getDefaultSet().getTitle());
    } else {
      prefs.remove("defaultSet");
    }
    try
    {
      prefs.flush();
    }
    catch (BackingStoreException e)
    {
      TeamPlugin.log(4, NLS.bind(Messages.SubscriberChangeSetCollector_3, new String[] { getName() }), e);
    }
  }
  
  private static String escapePrefName(String string)
  {
    StringBuffer out = new StringBuffer();
    for (int i = 0; i < string.length(); i++)
    {
      char c = string.charAt(i);
      switch (c)
      {
      case '/': 
        out.append("\\s");
        break;
      case '\\': 
        out.append("\\\\");
        break;
      default: 
        out.append(c);
      }
    }
    return out.toString();
  }
  
  protected void load(Preferences prefs)
  {
    String defaultSetTitle = prefs.get("defaultSet", null);
    try
    {
      String[] childNames = prefs.childrenNames();
      for (int i = 0; i < childNames.length; i++)
      {
        String string = childNames[i];
        Preferences childPrefs = prefs.node(string);
        ActiveChangeSet set = createSet(childPrefs);
        if (!set.isEmpty())
        {
          if ((getDefaultSet() == null) && (defaultSetTitle != null) && (set.getTitle().equals(defaultSetTitle))) {
            makeDefault(set);
          }
          add(set);
        }
      }
    }
    catch (BackingStoreException e)
    {
      TeamPlugin.log(4, NLS.bind(Messages.SubscriberChangeSetCollector_4, new String[] { getName() }), e);
    }
  }
  
  protected abstract String getName();
  
  protected ActiveChangeSet createSet(Preferences childPrefs)
  {
    ActiveChangeSet changeSet = doCreateSet(null);
    changeSet.init(childPrefs);
    return changeSet;
  }
  
  public void ensureChangesGrouped(IProject project, IFile[] files, String name)
    throws CoreException
  {
    ActiveChangeSet set = getSet(name);
    if (set == null)
    {
      set = createSet(name, files);
      set.setUserCreated(false);
      add(set);
    }
    else
    {
      set.setUserCreated(false);
      set.add(files);
    }
  }
}

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

class BatchingChangeSetManager$1
  implements ISafeRunnable
{
  final BatchingChangeSetManager this$0;
  private final BatchingChangeSetManager.IChangeSetCollectorChangeListener val$csccl;
  private final BatchingChangeSetManager.CollectorChangeEvent val$event;
  private final IProgressMonitor val$monitor;
  
  BatchingChangeSetManager$1(BatchingChangeSetManager paramBatchingChangeSetManager, BatchingChangeSetManager.IChangeSetCollectorChangeListener paramIChangeSetCollectorChangeListener, BatchingChangeSetManager.CollectorChangeEvent paramCollectorChangeEvent, IProgressMonitor paramIProgressMonitor)
  {
    this$0 = paramBatchingChangeSetManager;val$csccl = paramIChangeSetCollectorChangeListener;val$event = paramCollectorChangeEvent;val$monitor = paramIProgressMonitor;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$csccl.changeSetChanges(val$event, val$monitor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.BatchingChangeSetManager.1
 * 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.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IPath;

public class BatchingChangeSetManager$CollectorChangeEvent
{
  Set added = new HashSet();
  Set removed = new HashSet();
  Map changed = new HashMap();
  private final BatchingChangeSetManager collector;
  
  public BatchingChangeSetManager$CollectorChangeEvent(BatchingChangeSetManager collector)
  {
    this.collector = collector;
  }
  
  private void setAdded(ChangeSet set)
  {
    added.add(set);
    removed.remove(set);
  }
  
  private void setRemoved(ChangeSet set)
  {
    added.remove(set);
    removed.add(set);
  }
  
  private void changed(ChangeSet changeSet, IPath[] allAffectedResources)
  {
    if (added.contains(changeSet)) {
      return;
    }
    IPath[] paths = (IPath[])changed.get(changeSet);
    if (paths == null)
    {
      changed.put(changeSet, allAffectedResources);
    }
    else
    {
      Set allPaths = new HashSet();
      for (int i = 0; i < paths.length; i++)
      {
        IPath path = paths[i];
        allPaths.add(path);
      }
      for (int i = 0; i < allAffectedResources.length; i++)
      {
        IPath path = allAffectedResources[i];
        allPaths.add(path);
      }
      changed.put(changeSet, (IPath[])allPaths.toArray(new IPath[allPaths.size()]));
    }
  }
  
  public boolean isEmpty()
  {
    return (changed.isEmpty()) && (added.isEmpty()) && (removed.isEmpty());
  }
  
  public ChangeSet[] getAddedSets()
  {
    return (ChangeSet[])added.toArray(new ChangeSet[added.size()]);
  }
  
  public ChangeSet[] getRemovedSets()
  {
    return (ChangeSet[])removed.toArray(new ChangeSet[removed.size()]);
  }
  
  public ChangeSet[] getChangedSets()
  {
    return (ChangeSet[])changed.keySet().toArray(new ChangeSet[changed.size()]);
  }
  
  public IPath[] getChangesFor(ChangeSet set)
  {
    return (IPath[])changed.get(set);
  }
  
  public BatchingChangeSetManager getSource()
  {
    return collector;
  }
}

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

public abstract interface BatchingChangeSetManager$IChangeSetCollectorChangeListener
{
  public abstract void changeSetChanges(BatchingChangeSetManager.CollectorChangeEvent paramCollectorChangeEvent, IProgressMonitor paramIProgressMonitor);
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.BatchingChangeSetManager.IChangeSetCollectorChangeListener
 * 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.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.ILock;
import org.eclipse.core.runtime.jobs.Job;

public class BatchingChangeSetManager
  extends ChangeSetManager
{
  private ILock lock = Job.getJobManager().newLock();
  
  public static class CollectorChangeEvent
  {
    Set added = new HashSet();
    Set removed = new HashSet();
    Map changed = new HashMap();
    private final BatchingChangeSetManager collector;
    
    public CollectorChangeEvent(BatchingChangeSetManager collector)
    {
      this.collector = collector;
    }
    
    private void setAdded(ChangeSet set)
    {
      added.add(set);
      removed.remove(set);
    }
    
    private void setRemoved(ChangeSet set)
    {
      added.remove(set);
      removed.add(set);
    }
    
    private void changed(ChangeSet changeSet, IPath[] allAffectedResources)
    {
      if (added.contains(changeSet)) {
        return;
      }
      IPath[] paths = (IPath[])changed.get(changeSet);
      if (paths == null)
      {
        changed.put(changeSet, allAffectedResources);
      }
      else
      {
        Set allPaths = new HashSet();
        for (int i = 0; i < paths.length; i++)
        {
          IPath path = paths[i];
          allPaths.add(path);
        }
        for (int i = 0; i < allAffectedResources.length; i++)
        {
          IPath path = allAffectedResources[i];
          allPaths.add(path);
        }
        changed.put(changeSet, (IPath[])allPaths.toArray(new IPath[allPaths.size()]));
      }
    }
    
    public boolean isEmpty()
    {
      return (changed.isEmpty()) && (added.isEmpty()) && (removed.isEmpty());
    }
    
    public ChangeSet[] getAddedSets()
    {
      return (ChangeSet[])added.toArray(new ChangeSet[added.size()]);
    }
    
    public ChangeSet[] getRemovedSets()
    {
      return (ChangeSet[])removed.toArray(new ChangeSet[removed.size()]);
    }
    
    public ChangeSet[] getChangedSets()
    {
      return (ChangeSet[])changed.keySet().toArray(new ChangeSet[changed.size()]);
    }
    
    public IPath[] getChangesFor(ChangeSet set)
    {
      return (IPath[])changed.get(set);
    }
    
    public BatchingChangeSetManager getSource()
    {
      return collector;
    }
  }
  
  private CollectorChangeEvent changes = new CollectorChangeEvent(this);
  
  public void beginInput()
  {
    lock.acquire();
  }
  
  /* Error */
  public void endInput(IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 103	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:lock	Lorg/eclipse/core/runtime/jobs/ILock;
    //   4: invokeinterface 123 1 0
    //   9: iconst_1
    //   10: if_icmpne +26 -> 36
    //   13: aload_0
    //   14: aload_1
    //   15: invokestatic 107	org/eclipse/team/internal/core/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   18: invokespecial 111	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:fireChanges	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   21: goto +15 -> 36
    //   24: astore_2
    //   25: aload_0
    //   26: getfield 103	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:lock	Lorg/eclipse/core/runtime/jobs/ILock;
    //   29: invokeinterface 125 1 0
    //   34: aload_2
    //   35: athrow
    //   36: aload_0
    //   37: getfield 103	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:lock	Lorg/eclipse/core/runtime/jobs/ILock;
    //   40: invokeinterface 125 1 0
    //   45: return
    // Line number table:
    //   Java source line #107	-> byte code offset #0
    //   Java source line #110	-> byte code offset #13
    //   Java source line #112	-> byte code offset #24
    //   Java source line #113	-> byte code offset #25
    //   Java source line #114	-> byte code offset #34
    //   Java source line #113	-> byte code offset #36
    //   Java source line #115	-> byte code offset #45
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	46	0	this	BatchingChangeSetManager
    //   0	46	1	monitor	IProgressMonitor
    //   24	11	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	24	24	finally
  }
  
  private void fireChanges(IProgressMonitor monitor)
  {
    if (changes.isEmpty()) {
      return;
    }
    CollectorChangeEvent event = changes;
    changes = new CollectorChangeEvent(this);
    Object[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      IChangeSetChangeListener listener = (IChangeSetChangeListener)listeners[i];
      if ((listener instanceof IChangeSetCollectorChangeListener))
      {
        IChangeSetCollectorChangeListener csccl = (IChangeSetCollectorChangeListener)listener;
        SafeRunner.run(new ISafeRunnable()
        {
          private final BatchingChangeSetManager.IChangeSetCollectorChangeListener val$csccl;
          private final BatchingChangeSetManager.CollectorChangeEvent val$event;
          private final IProgressMonitor val$monitor;
          
          public void handleException(Throwable exception) {}
          
          public void run()
            throws Exception
          {
            val$csccl.changeSetChanges(val$event, val$monitor);
          }
        });
      }
    }
  }
  
  /* Error */
  public void add(ChangeSet set)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 108	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:beginInput	()V
    //   4: aload_0
    //   5: aload_1
    //   6: invokespecial 119	org/eclipse/team/internal/core/subscribers/ChangeSetManager:add	(Lorg/eclipse/team/internal/core/subscribers/ChangeSet;)V
    //   9: aload_0
    //   10: getfield 104	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:changes	Lorg/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent;
    //   13: aload_1
    //   14: invokestatic 115	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent:access$0	(Lorg/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent;Lorg/eclipse/team/internal/core/subscribers/ChangeSet;)V
    //   17: goto +11 -> 28
    //   20: astore_2
    //   21: aload_0
    //   22: aconst_null
    //   23: invokevirtual 110	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   26: aload_2
    //   27: athrow
    //   28: aload_0
    //   29: aconst_null
    //   30: invokevirtual 110	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   33: return
    // Line number table:
    //   Java source line #142	-> byte code offset #0
    //   Java source line #143	-> byte code offset #4
    //   Java source line #144	-> byte code offset #9
    //   Java source line #145	-> byte code offset #20
    //   Java source line #146	-> byte code offset #21
    //   Java source line #147	-> byte code offset #26
    //   Java source line #146	-> byte code offset #28
    //   Java source line #148	-> byte code offset #33
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	34	0	this	BatchingChangeSetManager
    //   0	34	1	set	ChangeSet
    //   20	7	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	20	20	finally
  }
  
  /* Error */
  public void remove(ChangeSet set)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 108	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:beginInput	()V
    //   4: aload_0
    //   5: aload_1
    //   6: invokespecial 120	org/eclipse/team/internal/core/subscribers/ChangeSetManager:remove	(Lorg/eclipse/team/internal/core/subscribers/ChangeSet;)V
    //   9: aload_0
    //   10: getfield 104	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:changes	Lorg/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent;
    //   13: aload_1
    //   14: invokestatic 116	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent:access$1	(Lorg/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent;Lorg/eclipse/team/internal/core/subscribers/ChangeSet;)V
    //   17: goto +11 -> 28
    //   20: astore_2
    //   21: aload_0
    //   22: aconst_null
    //   23: invokevirtual 110	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   26: aload_2
    //   27: athrow
    //   28: aload_0
    //   29: aconst_null
    //   30: invokevirtual 110	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   33: return
    // Line number table:
    //   Java source line #152	-> byte code offset #0
    //   Java source line #153	-> byte code offset #4
    //   Java source line #154	-> byte code offset #9
    //   Java source line #155	-> byte code offset #20
    //   Java source line #156	-> byte code offset #21
    //   Java source line #157	-> byte code offset #26
    //   Java source line #156	-> byte code offset #28
    //   Java source line #158	-> byte code offset #33
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	34	0	this	BatchingChangeSetManager
    //   0	34	1	set	ChangeSet
    //   20	7	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	20	20	finally
  }
  
  /* Error */
  protected void fireResourcesChangedEvent(ChangeSet changeSet, IPath[] allAffectedResources)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: aload_2
    //   3: invokespecial 121	org/eclipse/team/internal/core/subscribers/ChangeSetManager:fireResourcesChangedEvent	(Lorg/eclipse/team/internal/core/subscribers/ChangeSet;[Lorg/eclipse/core/runtime/IPath;)V
    //   6: aload_0
    //   7: invokevirtual 108	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:beginInput	()V
    //   10: aload_0
    //   11: getfield 104	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:changes	Lorg/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent;
    //   14: aload_1
    //   15: aload_2
    //   16: invokestatic 117	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent:access$2	(Lorg/eclipse/team/internal/core/subscribers/BatchingChangeSetManager$CollectorChangeEvent;Lorg/eclipse/team/internal/core/subscribers/ChangeSet;[Lorg/eclipse/core/runtime/IPath;)V
    //   19: goto +11 -> 30
    //   22: astore_3
    //   23: aload_0
    //   24: aconst_null
    //   25: invokevirtual 110	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   28: aload_3
    //   29: athrow
    //   30: aload_0
    //   31: aconst_null
    //   32: invokevirtual 110	org/eclipse/team/internal/core/subscribers/BatchingChangeSetManager:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   35: return
    // Line number table:
    //   Java source line #161	-> byte code offset #0
    //   Java source line #163	-> byte code offset #6
    //   Java source line #164	-> byte code offset #10
    //   Java source line #165	-> byte code offset #22
    //   Java source line #166	-> byte code offset #23
    //   Java source line #167	-> byte code offset #28
    //   Java source line #166	-> byte code offset #30
    //   Java source line #168	-> byte code offset #35
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	36	0	this	BatchingChangeSetManager
    //   0	36	1	changeSet	ChangeSet
    //   0	36	2	allAffectedResources	IPath[]
    //   22	7	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   6	22	22	finally
  }
  
  protected void initializeSets() {}
  
  public static abstract interface IChangeSetCollectorChangeListener
  {
    public abstract void changeSetChanges(BatchingChangeSetManager.CollectorChangeEvent paramCollectorChangeEvent, IProgressMonitor paramIProgressMonitor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.BatchingChangeSetManager
 * 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.jobs.ISchedulingRule;

class BatchingLock$1
  implements ISchedulingRule
{
  public boolean contains(ISchedulingRule rule)
  {
    return false;
  }
  
  public boolean isConflicting(ISchedulingRule rule)
  {
    return false;
  }
}

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

public abstract interface BatchingLock$IFlushOperation
{
  public abstract void flush(BatchingLock.ThreadInfo paramThreadInfo, IProgressMonitor paramIProgressMonitor)
    throws TeamException;
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.core.subscribers.BatchingLock.IFlushOperation
 * 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.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
import org.eclipse.team.internal.core.Messages;
import org.eclipse.team.internal.core.TeamPlugin;

public class BatchingLock$ThreadInfo
{
  private Set changedResources;
  private BatchingLock.IFlushOperation operation;
  private List rules;
  final BatchingLock this$0;
  
  public BatchingLock$ThreadInfo(BatchingLock paramBatchingLock, BatchingLock.IFlushOperation operation)
  {
    this$0 = paramBatchingLock;changedResources = new HashSet();rules = new ArrayList();
    this.operation = operation;
  }
  
  /* Error */
  public ISchedulingRule pushRule(ISchedulingRule resource, org.eclipse.core.runtime.IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: invokespecial 228	org/eclipse/team/internal/core/subscribers/BatchingLock$ThreadInfo:getRuleForResoure	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;)Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   5: astore_3
    //   6: aload_3
    //   7: getstatic 204	org/eclipse/team/internal/core/subscribers/BatchingLock:NULL_SCHEDULING_RULE	Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   10: if_acmpeq +89 -> 99
    //   13: iconst_0
    //   14: istore 4
    //   16: invokestatic 218	org/eclipse/core/runtime/jobs/Job:getJobManager	()Lorg/eclipse/core/runtime/jobs/IJobManager;
    //   19: aload_3
    //   20: aload_
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