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

potentialChildren = new HashSet();
      IContainer container = (IContainer)resource;
      if (container.exists()) {
        potentialChildren.addAll(Arrays.asList(container.members()));
      }
      potentialChildren.addAll(Arrays.asList(cache.members(resource)));
      List result = new ArrayList();
      for (Iterator iter = potentialChildren.iterator(); iter.hasNext();)
      {
        IResource child = (IResource)iter.next();
        if ((child.exists()) || (hasSyncBytes(child))) {
          result.add(child);
        }
      }
      return (IResource[])result.toArray(new IResource[result.size()]);
    }
    catch (CoreException e)
    {
      throw TeamException.asTeamException(e);
    }
  }
  
  /* Error */
  public void flush(IResource resource, int depth)
    throws TeamException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: aload_0
    //   3: aload_1
    //   4: aconst_null
    //   5: invokespecial 346	org/eclipse/team/core/variants/ThreeWaySynchronizer:beginBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   8: astore_3
    //   9: aload_0
    //   10: invokespecial 331	org/eclipse/team/core/variants/ThreeWaySynchronizer:beginOperation	()V
    //   13: aload_0
    //   14: getfield 307	org/eclipse/team/core/variants/ThreeWaySynchronizer:cache	Lorg/eclipse/team/core/variants/ResourceVariantByteStore;
    //   17: aload_1
    //   18: iload_2
    //   19: invokevirtual 327	org/eclipse/team/core/variants/ResourceVariantByteStore:flushBytes	(Lorg/eclipse/core/resources/IResource;I)Z
    //   22: ifeq +23 -> 45
    //   25: aload_0
    //   26: getfield 308	org/eclipse/team/core/variants/ThreeWaySynchronizer:batchingLock	Lorg/eclipse/team/internal/core/subscribers/BatchingLock;
    //   29: aload_1
    //   30: invokevirtual 352	org/eclipse/team/internal/core/subscribers/BatchingLock:resourceChanged	(Lorg/eclipse/core/resources/IResource;)V
    //   33: goto +12 -> 45
    //   36: astore 4
    //   38: aload_0
    //   39: invokespecial 332	org/eclipse/team/core/variants/ThreeWaySynchronizer:endOperation	()V
    //   42: aload 4
    //   44: athrow
    //   45: aload_0
    //   46: invokespecial 332	org/eclipse/team/core/variants/ThreeWaySynchronizer:endOperation	()V
    //   49: goto +18 -> 67
    //   52: astore 5
    //   54: aload_3
    //   55: ifnull +9 -> 64
    //   58: aload_0
    //   59: aload_3
    //   60: aconst_null
    //   61: invokespecial 345	org/eclipse/team/core/variants/ThreeWaySynchronizer:endBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   64: aload 5
    //   66: athrow
    //   67: aload_3
    //   68: ifnull +9 -> 77
    //   71: aload_0
    //   72: aload_3
    //   73: aconst_null
    //   74: invokespecial 345	org/eclipse/team/core/variants/ThreeWaySynchronizer:endBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   77: return
    // Line number table:
    //   Java source line #359	-> byte code offset #0
    //   Java source line #361	-> byte code offset #2
    //   Java source line #363	-> byte code offset #9
    //   Java source line #364	-> byte code offset #13
    //   Java source line #365	-> byte code offset #25
    //   Java source line #367	-> byte code offset #36
    //   Java source line #368	-> byte code offset #38
    //   Java source line #369	-> byte code offset #42
    //   Java source line #368	-> byte code offset #45
    //   Java source line #370	-> byte code offset #52
    //   Java source line #371	-> byte code offset #54
    //   Java source line #372	-> byte code offset #64
    //   Java source line #371	-> byte code offset #67
    //   Java source line #373	-> byte code offset #77
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	78	0	this	ThreeWaySynchronizer
    //   0	78	1	resource	IResource
    //   0	78	2	depth	int
    //   1	72	3	rule	ISchedulingRule
    //   36	7	4	localObject1	Object
    //   52	13	5	localObject2	Object
    // Exception table:
    //   from	to	target	type
    //   9	36	36	finally
    //   2	52	52	finally
  }
  
  /* Error */
  public void run(IResource resourceRule, org.eclipse.core.resources.IWorkspaceRunnable runnable, IProgressMonitor monitor)
    throws TeamException
  {
    // Byte code:
    //   0: aload_3
    //   1: invokestatic 349	org/eclipse/team/internal/core/Policy:monitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   4: astore_3
    //   5: aload_3
    //   6: aconst_null
    //   7: bipush 100
    //   9: invokeinterface 376 3 0
    //   14: aload_0
    //   15: aload_1
    //   16: aload_3
    //   17: bipush 10
    //   19: invokestatic 350	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   22: invokespecial 346	org/eclipse/team/core/variants/ThreeWaySynchronizer:beginBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/jobs/ISchedulingRule;
    //   25: astore 4
    //   27: aload_0
    //   28: getfield 307	org/eclipse/team/core/variants/ThreeWaySynchronizer:cache	Lorg/eclipse/team/core/variants/ResourceVariantByteStore;
    //   31: aload_1
    //   32: aload_2
    //   33: aload_3
    //   34: bipush 80
    //   36: invokestatic 350	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   39: invokevirtual 330	org/eclipse/team/core/variants/ResourceVariantByteStore:run	(Lorg/eclipse/core/resources/IResource;Lorg/eclipse/core/resources/IWorkspaceRunnable;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   42: goto +39 -> 81
    //   45: astore 5
    //   47: aload 5
    //   49: invokestatic 324	org/eclipse/team/core/TeamException:asTeamException	(Lorg/eclipse/core/runtime/CoreException;)Lorg/eclipse/team/core/TeamException;
    //   52: athrow
    //   53: astore 6
    //   55: aload 4
    //   57: ifnull +15 -> 72
    //   60: aload_0
    //   61: aload 4
    //   63: aload_3
    //   64: bipush 10
    //   66: invokestatic 350	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   69: invokespecial 345	org/eclipse/team/core/variants/ThreeWaySynchronizer:endBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   72: aload_3
    //   73: invokeinterface 375 1 0
    //   78: aload 6
    //   80: athrow
    //   81: aload 4
    //   83: ifnull +15 -> 98
    //   86: aload_0
    //   87: aload 4
    //   89: aload_3
    //   90: bipush 10
    //   92: invokestatic 350	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   95: invokespecial 345	org/eclipse/team/core/variants/ThreeWaySynchronizer:endBatching	(Lorg/eclipse/core/runtime/jobs/ISchedulingRule;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   98: aload_3
    //   99: invokeinterface 375 1 0
    //   104: return
    // Line number table:
    //   Java source line #384	-> byte code offset #0
    //   Java source line #385	-> byte code offset #5
    //   Java source line #386	-> byte code offset #14
    //   Java source line #388	-> byte code offset #27
    //   Java source line #389	-> byte code offset #45
    //   Java source line #390	-> byte code offset #47
    //   Java source line #391	-> byte code offset #53
    //   Java source line #392	-> byte code offset #55
    //   Java source line #393	-> byte code offset #72
    //   Java source line #394	-> byte code offset #78
    //   Java source line #392	-> byte code offset #81
    //   Java source line #393	-> byte code offset #98
    //   Java source line #395	-> byte code offset #104
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	105	0	this	ThreeWaySynchronizer
    //   0	105	1	resourceRule	IResource
    //   0	105	2	runnable	org.eclipse.core.resources.IWorkspaceRunnable
    //   0	105	3	monitor	IProgressMonitor
    //   25	63	4	rule	ISchedulingRule
    //   45	3	5	e	CoreException
    //   53	26	6	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   27	42	45	org/eclipse/core/runtime/CoreException
    //   27	53	53	finally
  }
  
  private void broadcastSyncChanges(IResource[] resources)
  {
    ISynchronizerChangeListener[] allListeners;
    synchronized (listeners)
    {
      allListeners = (ISynchronizerChangeListener[])listeners.toArray(new ISynchronizerChangeListener[listeners.size()]);
    }
    ISynchronizerChangeListener[] allListeners;
    for (int i = 0; i < allListeners.length; i++)
    {
      ISynchronizerChangeListener listener = allListeners[i];
      SafeRunner.run(new ISafeRunnable()
      {
        private final ISynchronizerChangeListener val$listener;
        private final IResource[] val$resources;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$listener.syncStateChanged(val$resources);
        }
      });
    }
  }
  
  private byte[] internalGetSyncBytes(IResource resource)
    throws TeamException
  {
    byte[] bytes = cache.getBytes(resource);
    if ((bytes != null) && (equals(bytes, IGNORED_BYTES))) {
      return null;
    }
    return bytes;
  }
  
  private boolean internalSetSyncBytes(IResource resource, byte[] syncBytes)
    throws TeamException
  {
    return cache.setBytes(resource, syncBytes);
  }
  
  private byte[] getSlot(byte[] syncBytes, int i)
  {
    return SyncByteConverter.getSlot(syncBytes, i, false);
  }
  
  private byte[] setSlot(byte[] syncBytes, int i, byte[] insertBytes)
    throws TeamException
  {
    return SyncByteConverter.setSlot(syncBytes, i, insertBytes);
  }
  
  private byte[] toBytes(String[] slots)
  {
    return SyncByteConverter.toBytes(slots);
  }
  
  private long getLocalTimestamp(IResource resource)
    throws TeamException
  {
    try
    {
      beginOperation();
      byte[] syncBytes = internalGetSyncBytes(resource);
      if (syncBytes == null) {
        return -1L;
      }
      byte[] bytes = getSlot(syncBytes, 0);
      if ((bytes == null) || (bytes.length == 0)) {
        return -1L;
      }
      return Long.parseLong(new String(bytes));
    }
    finally
    {
      endOperation();
    }
  }
  
  private boolean equals(byte[] syncBytes, byte[] oldBytes)
  {
    if (syncBytes.length != oldBytes.length) {
      return false;
    }
    for (int i = 0; i < oldBytes.length; i++) {
      if (oldBytes[i] != syncBytes[i]) {
        return false;
      }
    }
    return true;
  }
  
  private void beginOperation()
  {
    if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
      return;
    }
    lock.acquire();
  }
  
  private void endOperation()
  {
    if (ResourcesPlugin.getWorkspace().isTreeLocked()) {
      return;
    }
    lock.release();
  }
  
  private ISchedulingRule beginBatching(ISchedulingRule resourceRule, IProgressMonitor monitor)
  {
    return batchingLock.acquire(resourceRule, flushOperation, monitor);
  }
  
  private void endBatching(ISchedulingRule rule, IProgressMonitor monitor)
    throws TeamException
  {
    batchingLock.release(rule, monitor);
  }
}

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

import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.team.internal.core.mapping.ModelProviderResourceMapping;

public class AdapterFactory
  implements IAdapterFactory
{
  public Object getAdapter(Object adaptableObject, Class adapterType)
  {
    if (((adaptableObject instanceof ModelProvider)) && (adapterType == ResourceMapping.class))
    {
      ModelProvider mp = (ModelProvider)adaptableObject;
      return new ModelProviderResourceMapping(mp);
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] { ResourceMapping.class };
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;

class BackgroundEventHandler$1
  extends Job
{
  final BackgroundEventHandler this$0;
  
  BackgroundEventHandler$1(BackgroundEventHandler paramBackgroundEventHandler, String $anonymous0)
  {
    super($anonymous0);this$0 = paramBackgroundEventHandler;
  }
  
  public IStatus run(IProgressMonitor monitor)
  {
    return this$0.processEvents(monitor);
  }
  
  public boolean shouldRun()
  {
    return !this$0.isQueueEmpty();
  }
  
  public boolean shouldSchedule()
  {
    return !this$0.isQueueEmpty();
  }
  
  public boolean belongsTo(Object family)
  {
    return this$0.belongsTo(family);
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;

class BackgroundEventHandler$2
  extends JobChangeAdapter
{
  final BackgroundEventHandler this$0;
  
  BackgroundEventHandler$2(BackgroundEventHandler paramBackgroundEventHandler)
  {
    this$0 = paramBackgroundEventHandler;
  }
  
  public void done(IJobChangeEvent event)
  {
    this$0.jobDone(event);
  }
}

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

import org.eclipse.core.resources.IResource;

public class BackgroundEventHandler$Event
{
  private int type;
  
  public BackgroundEventHandler$Event(int type)
  {
    this.type = type;
  }
  
  public int getType()
  {
    return type;
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("Background Event: ");
    buffer.append(getTypeString());
    return buffer.toString();
  }
  
  public IResource getResource()
  {
    return null;
  }
  
  protected String getTypeString()
  {
    return String.valueOf(type);
  }
}

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

import org.eclipse.core.resources.IResource;

public class BackgroundEventHandler$ResourceEvent
  extends BackgroundEventHandler.Event
{
  private IResource resource;
  private int depth;
  
  public BackgroundEventHandler$ResourceEvent(IResource resource, int type, int depth)
  {
    super(type);
    this.resource = resource;
    this.depth = depth;
  }
  
  public int getDepth()
  {
    return depth;
  }
  
  public IResource getResource()
  {
    return resource;
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("resource: ");
    buffer.append(resource.getFullPath());
    buffer.append(" type: ");
    buffer.append(getTypeString());
    buffer.append(" depth: ");
    buffer.append(getDepthString());
    return buffer.toString();
  }
  
  protected String getDepthString()
  {
    switch (depth)
    {
    case 0: 
      return "DEPTH_ZERO";
    case 1: 
      return "DEPTH_ONE";
    case 2: 
      return "DEPTH_INFINITE";
    }
    return "INVALID";
  }
}

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

import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;

public class BackgroundEventHandler$RunnableEvent
  extends BackgroundEventHandler.Event
{
  private IWorkspaceRunnable runnable;
  private boolean preemtive;
  
  public BackgroundEventHandler$RunnableEvent(IWorkspaceRunnable runnable, boolean preemtive)
  {
    super(1000);
    this.runnable = runnable;
    this.preemtive = preemtive;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    runnable.run(monitor);
  }
  
  public boolean isPreemtive()
  {
    return preemtive;
  }
}

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

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.core.TeamException;

public abstract class BackgroundEventHandler
{
  public static final int RUNNABLE_EVENT = 1000;
  private List awaitingProcessing = new ArrayList();
  private Job eventHandlerJob;
  private boolean shutdown;
  private ExceptionCollector errors;
  private long timeOfLastDispatch = 0L;
  private int dispatchCount;
  private static final long DISPATCH_DELAY = 1500L;
  private static final long LONG_DISPATCH_DELAY = 10000L;
  private static final int DISPATCH_THRESHOLD = 3;
  private static final long WAIT_DELAY = 100L;
  private String jobName;
  
  public static class Event
  {
    private int type;
    
    public Event(int type)
    {
      this.type = type;
    }
    
    public int getType()
    {
      return type;
    }
    
    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("Background Event: ");
      buffer.append(getTypeString());
      return buffer.toString();
    }
    
    public IResource getResource()
    {
      return null;
    }
    
    protected String getTypeString()
    {
      return String.valueOf(type);
    }
  }
  
  public static class ResourceEvent
    extends BackgroundEventHandler.Event
  {
    private IResource resource;
    private int depth;
    
    public ResourceEvent(IResource resource, int type, int depth)
    {
      super();
      this.resource = resource;
      this.depth = depth;
    }
    
    public int getDepth()
    {
      return depth;
    }
    
    public IResource getResource()
    {
      return resource;
    }
    
    public String toString()
    {
      StringBuffer buffer = new StringBuffer();
      buffer.append("resource: ");
      buffer.append(resource.getFullPath());
      buffer.append(" type: ");
      buffer.append(getTypeString());
      buffer.append(" depth: ");
      buffer.append(getDepthString());
      return buffer.toString();
    }
    
    protected String getDepthString()
    {
      switch (depth)
      {
      case 0: 
        return "DEPTH_ZERO";
      case 1: 
        return "DEPTH_ONE";
      case 2: 
        return "DEPTH_INFINITE";
      }
      return "INVALID";
    }
  }
  
  public static class RunnableEvent
    extends BackgroundEventHandler.Event
  {
    private IWorkspaceRunnable runnable;
    private boolean preemtive;
    
    public RunnableEvent(IWorkspaceRunnable runnable, boolean preemtive)
    {
      super();
      this.runnable = runnable;
      this.preemtive = preemtive;
    }
    
    public void run(IProgressMonitor monitor)
      throws CoreException
    {
      runnable.run(monitor);
    }
    
    public boolean isPreemtive()
    {
      return preemtive;
    }
  }
  
  protected BackgroundEventHandler(String jobName, String errorTitle)
  {
    this.jobName = jobName;
    errors = 
      new ExceptionCollector(
      errorTitle, 
      "org.eclipse.team.core", 
      4, 
      null);
    
    createEventHandlingJob();
    schedule();
  }
  
  protected void createEventHandlingJob()
  {
    eventHandlerJob = new Job(getName())
    {
      public IStatus run(IProgressMonitor monitor)
      {
        return processEvents(monitor);
      }
      
      public boolean shouldRun()
      {
        return !isQueueEmpty();
      }
      
      public boolean shouldSchedule()
      {
        return !isQueueEmpty();
      }
      
      public boolean belongsTo(Object family)
      {
        return BackgroundEventHandler.this.belongsTo(family);
      }
    };
    eventHandlerJob.addJobChangeListener(new JobChangeAdapter()
    {
      public void done(IJobChangeEvent event)
      {
        jobDone(event);
      }
    });
    eventHandlerJob.setSystem(true);
    eventHandlerJob.setPriority(20);
  }
  
  protected boolean belongsTo(Object family)
  {
    return getJobFamiliy() == family;
  }
  
  protected Object getJobFamiliy()
  {
    return null;
  }
  
  protected void jobDone(IJobChangeEvent event)
  {
    if (isShutdown()) {
      synchronized (this)
      {
        awaitingProcessing.clear();
      }
    }
    if (!isQueueEmpty()) {
      schedule();
    }
  }
  
  protected void schedule()
  {
    eventHandlerJob.schedule();
  }
  
  public void shutdown()
  {
    shutdown = true;
    eventHandlerJob.cancel();
  }
  
  public boolean isShutdown()
  {
    return shutdown;
  }
  
  protected synchronized void queueEvent(Event event, boolean front)
  {
    if (Policy.DEBUG_BACKGROUND_EVENTS) {
      System.out.println("Event queued on " + getName() + ":" + event.toString());
    }
    if (front) {
      awaitingProcessing.add(0, event);
    } else {
      awaitingProcessing.add(event);
    }
    if ((!isShutdown()) && (eventHandlerJob != null)) {
      if (eventHandlerJob.getState() == 0) {
        schedule();
      } else {
        notify();
      }
    }
  }
  
  protected String getName()
  {
    return jobName;
  }
  
  protected synchronized Event nextElement()
  {
    if ((isShutdown()) || (isQueueEmpty())) {
      return null;
    }
    return (Event)awaitingProcessing.remove(0);
  }
  
  protected synchronized Event peek()
  {
    if ((isShutdown()) || (isQueueEmpty())) {
      return null;
    }
    return (Event)awaitingProcessing.get(0);
  }
  
  protected synchronized boolean isQueueEmpty()
  {
    return awaitingProcessing.isEmpty();
  }
  
  /* Error */
  protected IStatus processEvents(IProgressMonitor monitor)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 227	org/eclipse/team/internal/core/BackgroundEventHandler:errors	Lorg/eclipse/team/internal/core/ExceptionCollector;
    //   4: invokevirtual 263	org/eclipse/team/internal/core/ExceptionCollector:clear	()V
    //   7: aload_1
    //   8: aconst_null
    //   9: iconst_m1
    //   10: invokeinterface 276 3 0
    //   15: aload_1
    //   16: bipush 90
    //   18: invokestatic 267	org/eclipse/team/internal/core/Policy:infiniteSubMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   21: astore_2
    //   22: aload_2
    //   23: aconst_null
    //   24: sipush 1024
    //   27: invokeinterface 276 3 0
    //   32: aload_0
    //   33: invokestatic 236	java/lang/System:currentTimeMillis	()J
    //   36: putfield 222	org/eclipse/team/internal/core/BackgroundEventHandler:timeOfLastDispatch	J
    //   39: aload_0
    //   40: iconst_1
    //   41: putfield 221	org/eclipse/team/internal/core/BackgroundEventHandler:dispatchCount	I
    //   44: goto +80 -> 124
    //   47: aload_0
    //   48: aload_3
    //   49: aload_2
    //   50: invokevirtual 259	org/eclipse/team/internal/core/BackgroundEventHandler:processEvent	(Lorg/eclipse/team/internal/core/BackgroundEventHandler$Event;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   53: getstatic 228	org/eclipse/team/internal/core/Policy:DEBUG_BACKGROUND_EVENTS	Z
    //   56: ifeq +40 -> 96
    //   59: getstatic 220	java/lang/System:out	Ljava/io/PrintStream;
    //   62: new 117	java/lang/StringBuffer
    //   65: dup
    //   66: ldc 2
    //   68: invokespecial 234	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   71: aload_0
    //   72: invokevirtual 254	org/eclipse/team/internal/core/BackgroundEventHandler:getName	()Ljava/lang/String;
    //   75: invokevirtual 235	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   78: ldc 1
    //   80: invokevirtual 235	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   83: aload_3
    //   84: invokevirtual 262	org/eclipse/team/internal/core/BackgroundEventHandler$Event:toString	()Ljava/lang/String;
    //   87: invokevirtual 235	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   90: invokevirtual 233	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   93: invokevirtual 229	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   96: aload_0
    //   97: iconst_1
    //   98: invokevirtual 252	org/eclipse/team/internal/core/BackgroundEventHandler:isReadyForDispatch	(Z)Z
    //   101: ifeq +23 -> 124
    //   104: aload_0
    //   105: aload_2
    //   106: iconst_1
    //   107: invokestatic 268	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   110: invokevirtual 256	org/eclipse/team/internal/core/BackgroundEventHandler:dispatchEvents	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   113: goto +11 -> 124
    //   116: astore 4
    //   118: aload_0
    //   119: aload 4
    //   121: invokevirtual 255	org/eclipse/team/internal/core/BackgroundEventHandler:handleException	(Lorg/eclipse/core/runtime/CoreException;)V
    //   124: aload_0
    //   125: invokevirtual 258	org/eclipse/team/internal/core/BackgroundEventHandler:nextElement	()Lorg/eclipse/team/internal/core/BackgroundEventHandler$Event;
    //   128: dup
    //   129: astore_3
    //   130: ifnull +24 -> 154
    //   133: aload_0
    //   134: invokevirtual 251	org/eclipse/team/internal/core/BackgroundEventHandler:isShutdown	()Z
    //   137: ifeq -90 -> 47
    //   140: goto +14 -> 154
    //   143: astore 5
    //   145: aload_1
    //   146: invokeinterface 275 1 0
    //   151: aload 5
    //   153: athrow
    //   154: aload_1
    //   155: invokeinterface 275 1 0
    //   160: aload_0
    //   161: getfield 227	org/eclipse/team/internal/core/BackgroundEventHandler:errors	Lorg/eclipse/team/internal/core/ExceptionCollector;
    //   164: invokevirtual 265	org/eclipse/team/internal/core/ExceptionCollector:getStatus	()Lorg/eclipse/core/runtime/IStatus;
    //   167: areturn
    // Line number table:
    //   Java source line #355	-> byte code offset #0
    //   Java source line #360	-> byte code offset #7
    //   Java source line #361	-> byte code offset #15
    //   Java source line #362	-> byte code offset #22
    //   Java source line #365	-> byte code offset #32
    //   Java source line #366	-> byte code offset #39
    //   Java source line #367	-> byte code offset #44
    //   Java source line #369	-> byte code offset #47
    //   Java source line #370	-> byte code offset #53
    //   Java source line #371	-> byte code offset #59
    //   Java source line #373	-> byte code offset #96
    //   Java source line #374	-> byte code offset #104
    //   Java source line #376	-> byte code offset #116
    //   Java source line #378	-> byte code offset #118
    //   Java source line #367	-> byte code offset #124
    //   Java source line #381	-> byte code offset #143
    //   Java source line #382	-> byte code offset #145
    //   Java source line #383	-> byte code offset #151
    //   Java source line #382	-> byte code offset #154
    //   Java source line #384	-> byte code offset #160
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	168	0	this	BackgroundEventHandler
    //   0	168	1	monitor	IProgressMonitor
    //   21	85	2	subMonitor	IProgressMonitor
    //   47	37	3	event	Event
    //   129	2	3	event	Event
    //   116	4	4	e	CoreException
    //   143	9	5	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   47	113	116	org/eclipse/core/runtime/CoreException
    //   7	143	143	finally
  }
  
  protected final void dispatchEvents(IProgressMonitor monitor)
    throws TeamException
  {
    if (doDispatchEvents(monitor)) {
      dispatchCount += 1;
    }
    timeOfLastDispatch = System.currentTimeMillis();
  }
  
  protected abstract boolean doDispatchEvents(IProgressMonitor paramIProgressMonitor)
    throws TeamException;
  
  protected boolean isReadyForDispatch(boolean wait)
  {
    if (isDispatchDelayExceeded()) {
      return true;
    }
    synchronized (this)
    {
      if ((!isQueueEmpty()) || (!wait)) {
        return false;
      }
      try
      {
        wait(getDispatchWaitDelay());
      }
      catch (InterruptedException localInterruptedException) {}
    }
    return (isQueueEmpty()) || (isDispatchDelayExceeded());
  }
  
  private boolean isDispatchDelayExceeded()
  {
    long duration = System.currentTimeMillis() - timeOfLastDispatch;
    
    return ((dispatchCount < 3) && (duration >= getShortDispatchDelay())) || (duration >= getLongDispatchDelay());
  }
  
  protected long getDispatchWaitDelay()
  {
    return 100L;
  }
  
  protected long getShortDispatchDelay()
  {
    return 1500L;
  }
  
  protected long getLongDispatchDelay()
  {
    return 10000L;
  }
  
  protected void handleException(CoreException e)
  {
    errors.handleException(e);
  }
  
  protected abstract void processEvent(Event paramEvent, IProgressMonitor paramIProgressMonitor)
    throws CoreException;
  
  public Job getEventHandlerJob()
  {
    return eventHandlerJob;
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.team.core.ICacheListener;

class Cache$1
  implements ISafeRunnable
{
  final Cache this$0;
  private final Object val$listener;
  
  Cache$1(Cache paramCache, Object paramObject)
  {
    this$0 = paramCache;val$listener = paramObject;
  }
  
  public void run()
    throws Exception
  {
    ((ICacheListener)val$listener).cacheDisposed(this$0);
  }
  
  public void handleException(Throwable exception) {}
}

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

import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.team.core.ICache;
import org.eclipse.team.core.ICacheListener;

public class Cache
  implements ICache
{
  Map properties;
  ListenerList listeners;
  
  public synchronized void put(String name, Object value)
  {
    if (properties == null) {
      properties = new HashMap();
    }
    properties.put(name, value);
  }
  
  public synchronized Object get(String name)
  {
    if (properties == null) {
      return null;
    }
    return properties.get(name);
  }
  
  public synchronized void remove(String name)
  {
    if (properties != null) {
      properties.remove(name);
    }
    if (properties.isEmpty()) {
      properties = null;
    }
  }
  
  public synchronized void addCacheListener(ICacheListener listener)
  {
    if (listeners == null) {
      listeners = new ListenerList(1);
    }
    listeners.add(listener);
  }
  
  public synchronized void removeDisposeListener(ICacheListener listener)
  {
    removeCacheListener(listener);
  }
  
  public synchronized void removeCacheListener(ICacheListener listener)
  {
    if (listeners != null) {
      listeners.remove(listener);
    }
  }
  
  public void dispose()
  {
    if (listeners != null)
    {
      Object[] allListeners = listeners.getListeners();
      for (int i = 0; i < allListeners.length; i++)
      {
        Object listener = allListeners[i];
        SafeRunner.run(new ISafeRunnable()
        {
          private final Object val$listener;
          
          public void run()
            throws Exception
          {
            ((ICacheListener)val$listener).cacheDisposed(Cache.this);
          }
          
          public void handleException(Throwable exception) {}
        });
      }
    }
    properties = null;
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.team.FileModificationValidationContext;
import org.eclipse.core.resources.team.FileModificationValidator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamStatus;

public class DefaultFileModificationValidator
  extends FileModificationValidator
{
  private FileModificationValidator uiValidator;
  
  protected IStatus getDefaultStatus(IFile file)
  {
    return 
      file.isReadOnly() ? 
      new TeamStatus(4, "org.eclipse.team.core", 279, NLS.bind(Messages.FileModificationValidator_fileIsReadOnly, new String[] { file.getFullPath().toString() }), null, file) : 
      Status.OK_STATUS;
  }
  
  public IStatus validateEdit(IFile[] files, FileModificationValidationContext context)
  {
    IFile[] readOnlyFiles = getReadOnly(files);
    if (readOnlyFiles.length == 0) {
      return Status.OK_STATUS;
    }
    synchronized (this)
    {
      if (uiValidator == null) {
        uiValidator = loadUIValidator();
      }
    }
    if (uiValidator != null) {
      return uiValidator.validateEdit(files, context);
    }
    return getStatus(files);
  }
  
  protected IStatus getStatus(IFile[] files)
  {
    if (files.length == 1) {
      return getDefaultStatus(files[0]);
    }
    IStatus[] stati = new Status[files.length];
    boolean allOK = true;
    for (int i = 0; i < files.length; i++)
    {
      stati[i] = getDefaultStatus(files[i]);
      if (!stati[i].isOK()) {
        allOK = false;
      }
    }
    return new MultiStatus("org.eclipse.team.core", 
      0, stati, 
      allOK ? 
      Messages.ok : 
      Messages.FileModificationValidator_someReadOnly, 
      null);
  }
  
  private IFile[] getReadOnly(IFile[] files)
  {
    List result = new ArrayList(files.length);
    for (int i = 0; i < files.length; i++)
    {
      IFile file = files[i];
      if (file.isReadOnly()) {
        result.add(file);
      }
    }
    return (IFile[])result.toArray(new IFile[result.size()]);
  }
  
  public IStatus validateSave(IFile file)
  {
    if (!file.isReadOnly()) {
      return Status.OK_STATUS;
    }
    synchronized (this)
    {
      if (uiValidator == null) {
        uiValidator = loadUIValidator();
      }
    }
    if (uiValidator != null) {
      return uiValidator.validateSave(file);
    }
    return getDefaultStatus(file);
  }
  
  private FileModificationValidator loadUIValidator()
  {
    IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.team.core", "defaultFileModificationValidator");
    if (extension != null)
    {
      IExtension[] extensions = extension.getExtensions();
      if (extensions.length > 0)
      {
        IConfigurationElement[] configElements = extensions[0].getConfigurationElements();
        if (configElements.length > 0) {
          try
          {
            Object o = configElements[0].createExecutableExtension("class");
            if ((o instanceof FileModificationValidator)) {
              return (FileModificationValidator)o;
            }
          }
          catch (CoreException e)
          {
            TeamPlugin.log(e);
          }
        }
      }
    }
    return null;
  }
}

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

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.team.IMoveDeleteHook;
import org.eclipse.core.resources.team.IResourceTree;
import org.eclipse.core.runtime.IProgressMonitor;

public class DefaultMoveDeleteHook
  implements IMoveDeleteHook
{
  public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags, IProgressMonitor monitor)
  {
    return false;
  }
  
  public boolean deleteFolder(IResourceTree tree, IFolder folder, int updateFlags, IProgressMonitor monitor)
  {
    return false;
  }
  
  public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor)
  {
    return false;
  }
  
  public boolean moveFile(IResourceTree tree, IFile source, IFile destination, int updateFlags, IProgressMonitor monitor)
  {
    return false;
  }
  
  public boolean moveFolder(IResourceTree tree, IFolder source, IFolder destination, int updateFlags, IProgressMonitor monitor)
  {
    return false;
  }
  
  public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor)
  {
    return false;
  }
}

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

import org.eclipse.team.core.ProjectSetCapability;

public class DefaultProjectSetCapability
  extends ProjectSetCapability
{}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;

public class ExceptionCollector
{
  private List statuses = new ArrayList();
  private String message;
  private String pluginId;
  private int severity;
  private ILog log;
  
  public ExceptionCollector(String message, String pluginId, int severity, ILog log)
  {
    this.message = message;
    this.pluginId = pluginId;
    this.severity = severity;
    this.log = log;
  }
  
  public void clear()
  {
    statuses.clear();
  }
  
  public IStatus getStatus()
  {
    if (statuses.isEmpty()) {
      return Status.OK_STATUS;
    }
    MultiStatus multiStatus = new MultiStatus(p
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