org.eclipse.team.ui_3.6.101.R37x_v20111109-0800

ateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
      }
    }
  }
}

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

import org.eclipse.jface.viewers.StructuredViewer;

class SynchronizeModelUpdateHandler$10
  implements Runnable
{
  final SynchronizeModelUpdateHandler.8 this$1;
  
  SynchronizeModelUpdateHandler$10(SynchronizeModelUpdateHandler.8 param8)
  {
    this$1 = param8;
  }
  
  public void run()
  {
    SynchronizeModelUpdateHandler.access$0(SynchronizeModelUpdateHandler.8.access$0(this$1)).getViewer().refresh();
    if (this$1.expanded != null) {
      SynchronizeModelUpdateHandler.access$0(SynchronizeModelUpdateHandler.8.access$0(this$1)).expandResources(this$1.expanded);
    }
    if (this$1.selected != null) {
      SynchronizeModelUpdateHandler.access$0(SynchronizeModelUpdateHandler.8.access$0(this$1)).selectResources(this$1.selected);
    }
  }
}

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

class SynchronizeModelUpdateHandler$2
  implements Runnable
{
  final SynchronizeModelUpdateHandler this$0;
  
  SynchronizeModelUpdateHandler$2(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler)
  {
    this$0 = paramSynchronizeModelUpdateHandler;
  }
  
  public void run()
  {
    this$0.firePendingLabelUpdates();
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;

class SynchronizeModelUpdateHandler$3
  implements Runnable
{
  final SynchronizeModelUpdateHandler this$0;
  private final ISyncInfoSetChangeEvent val$event;
  private final IProgressMonitor val$monitor;
  
  SynchronizeModelUpdateHandler$3(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, ISyncInfoSetChangeEvent paramISyncInfoSetChangeEvent, IProgressMonitor paramIProgressMonitor)
  {
    this$0 = paramSynchronizeModelUpdateHandler;val$event = paramISyncInfoSetChangeEvent;val$monitor = paramIProgressMonitor;
  }
  
  public void run()
  {
    SynchronizeModelUpdateHandler.access$0(this$0).handleChanges((ISyncInfoTreeChangeEvent)val$event, val$monitor);
    this$0.firePendingLabelUpdates();
  }
}

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

import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Control;

class SynchronizeModelUpdateHandler$4
  implements Runnable
{
  final SynchronizeModelUpdateHandler this$0;
  private final Control val$ctrl;
  private final Runnable val$runnable;
  private final boolean val$preserveExpansion;
  
  SynchronizeModelUpdateHandler$4(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, Control paramControl, Runnable paramRunnable, boolean paramBoolean)
  {
    this$0 = paramSynchronizeModelUpdateHandler;val$ctrl = paramControl;val$runnable = paramRunnable;val$preserveExpansion = paramBoolean;
  }
  
  public void run()
  {
    if (!val$ctrl.isDisposed()) {
      BusyIndicator.showWhile(val$ctrl.getDisplay(), new SynchronizeModelUpdateHandler.5(this, val$runnable, val$preserveExpansion));
    }
  }
}

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

class SynchronizeModelUpdateHandler$5
  implements Runnable
{
  final SynchronizeModelUpdateHandler.4 this$1;
  private final Runnable val$runnable;
  private final boolean val$preserveExpansion;
  
  SynchronizeModelUpdateHandler$5(SynchronizeModelUpdateHandler.4 param4, Runnable paramRunnable, boolean paramBoolean)
  {
    this$1 = param4;val$runnable = paramRunnable;val$preserveExpansion = paramBoolean;
  }
  
  public void run()
  {
    SynchronizeModelUpdateHandler.access$1(SynchronizeModelUpdateHandler.4.access$0(this$1), val$runnable, val$preserveExpansion);
  }
}

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

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

class SynchronizeModelUpdateHandler$6
  implements IWorkspaceRunnable
{
  final SynchronizeModelUpdateHandler this$0;
  private final IWorkspaceRunnable val$runnable;
  
  SynchronizeModelUpdateHandler$6(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, IWorkspaceRunnable paramIWorkspaceRunnable)
  {
    this$0 = paramSynchronizeModelUpdateHandler;val$runnable = paramIWorkspaceRunnable;
  }
  
  public void run(IProgressMonitor monitor)
    throws CoreException
  {
    CoreException[] exception = new CoreException[1];
    this$0.runViewUpdate(new SynchronizeModelUpdateHandler.7(this, val$runnable, monitor, exception), 
    
      true);
    if (exception[0] != null) {
      throw exception[0];
    }
  }
}

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

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

class SynchronizeModelUpdateHandler$7
  implements Runnable
{
  final SynchronizeModelUpdateHandler.6 this$1;
  private final IWorkspaceRunnable val$runnable;
  private final IProgressMonitor val$monitor;
  private final CoreException[] val$exception;
  
  SynchronizeModelUpdateHandler$7(SynchronizeModelUpdateHandler.6 param6, IWorkspaceRunnable paramIWorkspaceRunnable, IProgressMonitor paramIProgressMonitor, CoreException[] paramArrayOfCoreException)
  {
    this$1 = param6;val$runnable = paramIWorkspaceRunnable;val$monitor = paramIProgressMonitor;val$exception = paramArrayOfCoreException;
  }
  
  public void run()
  {
    try
    {
      val$runnable.run(val$monitor);
    }
    catch (CoreException e)
    {
      val$exception[0] = e;
    }
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;

class SynchronizeModelUpdateHandler$8
  implements IWorkspaceRunnable
{
  IResource[] expanded;
  IResource[] selected;
  final SynchronizeModelUpdateHandler this$0;
  private final boolean val$preserveExpansion;
  private final IWorkspaceRunnable val$runnable;
  
  SynchronizeModelUpdateHandler$8(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, boolean paramBoolean, IWorkspaceRunnable paramIWorkspaceRunnable)
  {
    this$0 = paramSynchronizeModelUpdateHandler;val$preserveExpansion = paramBoolean;val$runnable = paramIWorkspaceRunnable;
  }
  
  /* Error */
  public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.core.runtime.CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 80	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:val$preserveExpansion	Z
    //   4: ifeq +7 -> 11
    //   7: aload_0
    //   8: invokespecial 92	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:recordExpandedResources	()V
    //   11: aload_0
    //   12: getfield 82	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:this$0	Lorg/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler;
    //   15: iconst_1
    //   16: invokestatic 90	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:access$2	(Lorg/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler;Z)V
    //   19: aload_0
    //   20: getfield 81	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:val$runnable	Lorg/eclipse/core/resources/IWorkspaceRunnable;
    //   23: aload_1
    //   24: invokeinterface 95 2 0
    //   29: goto +14 -> 43
    //   32: astore_2
    //   33: aload_0
    //   34: getfield 82	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:this$0	Lorg/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler;
    //   37: iconst_0
    //   38: invokestatic 90	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:access$2	(Lorg/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler;Z)V
    //   41: aload_2
    //   42: athrow
    //   43: aload_0
    //   44: getfield 82	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:this$0	Lorg/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler;
    //   47: iconst_0
    //   48: invokestatic 90	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:access$2	(Lorg/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler;Z)V
    //   51: aload_0
    //   52: invokespecial 93	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler$8:updateView	()V
    //   55: return
    // Line number table:
    //   Java source line #656	-> byte code offset #0
    //   Java source line #657	-> byte code offset #7
    //   Java source line #659	-> byte code offset #11
    //   Java source line #660	-> byte code offset #19
    //   Java source line #661	-> byte code offset #32
    //   Java source line #662	-> byte code offset #33
    //   Java source line #663	-> byte code offset #41
    //   Java source line #662	-> byte code offset #43
    //   Java source line #664	-> byte code offset #51
    //   Java source line #666	-> byte code offset #55
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	56	0	this	8
    //   0	56	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   32	10	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   11	32	32	finally
  }
  
  private void recordExpandedResources()
  {
    StructuredViewer viewer = this$0.getViewer();
    if ((viewer != null) && (!viewer.getControl().isDisposed()) && ((viewer instanceof AbstractTreeViewer))) {
      viewer.getControl().getDisplay().syncExec(new SynchronizeModelUpdateHandler.9(this, viewer));
    }
  }
  
  private void updateView()
  {
    this$0.runViewUpdate(new SynchronizeModelUpdateHandler.10(this), 
    
      false);
  }
}

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

import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.widgets.Control;

class SynchronizeModelUpdateHandler$9
  implements Runnable
{
  final SynchronizeModelUpdateHandler.8 this$1;
  private final StructuredViewer val$viewer;
  
  SynchronizeModelUpdateHandler$9(SynchronizeModelUpdateHandler.8 param8, StructuredViewer paramStructuredViewer)
  {
    this$1 = param8;val$viewer = paramStructuredViewer;
  }
  
  public void run()
  {
    if ((val$viewer != null) && (!val$viewer.getControl().isDisposed()))
    {
      this$1.expanded = SynchronizeModelUpdateHandler.access$0(SynchronizeModelUpdateHandler.8.access$0(this$1)).getExpandedResources();
      this$1.selected = SynchronizeModelUpdateHandler.access$0(SynchronizeModelUpdateHandler.8.access$0(this$1)).getSelectedResources();
    }
  }
}

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

import org.eclipse.team.internal.core.BackgroundEventHandler.Event;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;

class SynchronizeModelUpdateHandler$BusyStateChangeEvent
  extends BackgroundEventHandler.Event
{
  private final ISynchronizeModelElement element;
  private final boolean isBusy;
  final SynchronizeModelUpdateHandler this$0;
  
  public SynchronizeModelUpdateHandler$BusyStateChangeEvent(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, ISynchronizeModelElement element, boolean isBusy)
  {
    super(2);this$0 = paramSynchronizeModelUpdateHandler;
    this.element = element;
    this.isBusy = isBusy;
  }
  
  public ISynchronizeModelElement getElement()
  {
    return element;
  }
  
  public boolean isBusy()
  {
    return isBusy;
  }
}

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

import org.eclipse.team.internal.core.BackgroundEventHandler.Event;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;

class SynchronizeModelUpdateHandler$MarkerChangeEvent
  extends BackgroundEventHandler.Event
{
  private final ISynchronizeModelElement[] elements;
  final SynchronizeModelUpdateHandler this$0;
  
  public SynchronizeModelUpdateHandler$MarkerChangeEvent(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, ISynchronizeModelElement[] elements)
  {
    super(1);this$0 = paramSynchronizeModelUpdateHandler;
    this.elements = elements;
  }
  
  public ISynchronizeModelElement[] getElements()
  {
    return elements;
  }
}

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

import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
import org.eclipse.team.internal.core.BackgroundEventHandler.Event;

class SynchronizeModelUpdateHandler$SyncInfoSetChangeEvent
  extends BackgroundEventHandler.Event
{
  private final ISyncInfoSetChangeEvent event;
  final SynchronizeModelUpdateHandler this$0;
  
  public SynchronizeModelUpdateHandler$SyncInfoSetChangeEvent(SynchronizeModelUpdateHandler paramSynchronizeModelUpdateHandler, ISyncInfoSetChangeEvent event)
  {
    super(4);this$0 = paramSynchronizeModelUpdateHandler;
    this.event = event;
  }
  
  public ISyncInfoSetChangeEvent getEvent()
  {
    return event;
  }
}

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

import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.SimpleDateFormat;
import java.io.PrintStream;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.ITeamStatus;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.ISyncInfoSetChangeEvent;
import org.eclipse.team.core.synchronize.ISyncInfoSetChangeListener;
import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.core.BackgroundEventHandler;
import org.eclipse.team.internal.core.BackgroundEventHandler.Event;
import org.eclipse.team.internal.core.BackgroundEventHandler.ResourceEvent;
import org.eclipse.team.internal.core.BackgroundEventHandler.RunnableEvent;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;

public class SynchronizeModelUpdateHandler
  extends BackgroundEventHandler
  implements IResourceChangeListener, ISyncInfoSetChangeListener
{
  private static final boolean DEBUG = Policy.DEBUG_SYNC_MODELS;
  private static final IWorkspaceRoot ROOT = ResourcesPlugin.getWorkspace().getRoot();
  private static final int MARKERS_CHANGED = 1;
  private static final int BUSY_STATE_CHANGED = 2;
  private static final int RESET = 3;
  private static final int SYNC_INFO_SET_CHANGED = 4;
  private AbstractSynchronizeModelProvider provider;
  private Set pendingLabelUpdates = Collections.synchronizedSet(new HashSet());
  private boolean dispatchEarly = false;
  private static final int EARLY_DISPATCH_INCREMENT = 100;
  
  class MarkerChangeEvent
    extends BackgroundEventHandler.Event
  {
    private final ISynchronizeModelElement[] elements;
    
    public MarkerChangeEvent(ISynchronizeModelElement[] elements)
    {
      super();
      this.elements = elements;
    }
    
    public ISynchronizeModelElement[] getElements()
    {
      return elements;
    }
  }
  
  class BusyStateChangeEvent
    extends BackgroundEventHandler.Event
  {
    private final ISynchronizeModelElement element;
    private final boolean isBusy;
    
    public BusyStateChangeEvent(ISynchronizeModelElement element, boolean isBusy)
    {
      super();
      this.element = element;
      this.isBusy = isBusy;
    }
    
    public ISynchronizeModelElement getElement()
    {
      return element;
    }
    
    public boolean isBusy()
    {
      return isBusy;
    }
  }
  
  class SyncInfoSetChangeEvent
    extends BackgroundEventHandler.Event
  {
    private final ISyncInfoSetChangeEvent event;
    
    public SyncInfoSetChangeEvent(ISyncInfoSetChangeEvent event)
    {
      super();
      this.event = event;
    }
    
    public ISyncInfoSetChangeEvent getEvent()
    {
      return event;
    }
  }
  
  private IPropertyChangeListener listener = new IPropertyChangeListener()
  {
    public void propertyChange(PropertyChangeEvent event)
    {
      if (event.getProperty() == "org.eclipse.team.ui.busy")
      {
        Object source = event.getSource();
        if ((source instanceof ISynchronizeModelElement)) {
          updateBusyState((ISynchronizeModelElement)source, ((Boolean)event.getNewValue()).booleanValue());
        }
      }
    }
  };
  private boolean performingBackgroundUpdate;
  private Map additionsMap;
  
  public SynchronizeModelUpdateHandler(AbstractSynchronizeModelProvider provider)
  {
    super(TeamUIMessages.SynchronizeModelProvider_0, TeamUIMessages.SynchronizeModelUpdateHandler_0);
    this.provider = provider;
    ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
    provider.getSyncInfoSet().addSyncSetChangedListener(this);
  }
  
  protected String[] getMarkerTypes()
  {
    return new String[] { "org.eclipse.core.resources.problemmarker" };
  }
  
  public StructuredViewer getViewer()
  {
    return provider.getViewer();
  }
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    String[] markerTypes = getMarkerTypes();
    Set handledResources = new HashSet();
    Set changes = new HashSet();
    for (int idx = 0; idx < markerTypes.length; idx++)
    {
      IMarkerDelta[] markerDeltas = event.findMarkerDeltas(markerTypes[idx], true);
      for (int i = 0; i < markerDeltas.length; i++)
      {
        IMarkerDelta delta = markerDeltas[i];
        IResource resource = delta.getResource();
        if (!handledResources.contains(resource))
        {
          handledResources.add(resource);
          ISynchronizeModelElement[] elements = provider.getClosestExistingParents(delta.getResource());
          if ((elements != null) && (elements.length > 0)) {
            for (int j = 0; j < elements.length; j++)
            {
              ISynchronizeModelElement element = elements[j];
              changes.add(element);
            }
          }
        }
      }
    }
    if (!changes.isEmpty()) {
      updateMarkersFor((ISynchronizeModelElement[])changes.toArray(new ISynchronizeModelElement[changes.size()]));
    }
  }
  
  private void updateMarkersFor(ISynchronizeModelElement[] elements)
  {
    queueEvent(new MarkerChangeEvent(elements), false);
  }
  
  protected void updateBusyState(ISynchronizeModelElement element, boolean isBusy)
  {
    queueEvent(new BusyStateChangeEvent(element, isBusy), false);
  }
  
  protected void processEvent(BackgroundEventHandler.Event event, IProgressMonitor monitor)
    throws CoreException
  {
    switch (event.getType())
    {
    case 1000: 
      executeRunnable(event, monitor);
      break;
    case 1: 
      long start = System.currentTimeMillis();
      ISynchronizeModelElement[] elements = getChangedElements(event);
      for (int i = 0; i < elements.length; i++)
      {
        ISynchronizeModelElement element = elements[i];
        propagateProblemMarkers(element);
        updateParentLabels(element);
      }
      if (DEBUG)
      {
        long time = System.currentTimeMillis() - start;
        DateFormat TIME_FORMAT = new SimpleDateFormat("m:ss.SSS");
        String took = TIME_FORMAT.format(new Date(time));
        System.out.println(took + " for " + elements.length + " files");
      }
      break;
    case 2: 
      BusyStateChangeEvent e = (BusyStateChangeEvent)event;
      queueForLabelUpdate(e.getElement());
      if (e.isBusy()) {
        dispatchEarly = true;
      }
      break;
    case 3: 
      pendingLabelUpdates.clear();
      provider.reset();
      break;
    case 4: 
      handleChanges(((SyncInfoSetChangeEvent)event).getEvent(), monitor);
    }
  }
  
  private ISynchronizeModelElement[] getChangedElements(BackgroundEventHandler.Event event)
  {
    if (event.getType() == 1) {
      return ((MarkerChangeEvent)event).getElements();
    }
    return new ISynchronizeModelElement[0];
  }
  
  protected boolean doDispatchEvents(IProgressMonitor monitor)
    throws TeamException
  {
    dispatchEarly = false;
    if (pendingLabelUpdates.isEmpty()) {
      return false;
    }
    Utils.asyncExec(new Runnable()
    {
      public void run()
      {
        firePendingLabelUpdates();
      }
    }, getViewer());
    return true;
  }
  
  /* Error */
  protected void firePendingLabelUpdates()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 641	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:getViewer	()Lorg/eclipse/jface/viewers/StructuredViewer;
    //   4: invokestatic 613	org/eclipse/team/internal/ui/Utils:canUpdateViewer	(Lorg/eclipse/jface/viewers/StructuredViewer;)Z
    //   7: ifne +4 -> 11
    //   10: return
    //   11: aload_0
    //   12: getfield 573	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:pendingLabelUpdates	Ljava/util/Set;
    //   15: aload_0
    //   16: getfield 573	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:pendingLabelUpdates	Ljava/util/Set;
    //   19: invokeinterface 676 1 0
    //   24: anewarray 277	java/lang/Object
    //   27: invokeinterface 682 2 0
    //   32: astore_1
    //   33: aload_0
    //   34: aload_1
    //   35: invokespecial 634	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:updateLabels	([Ljava/lang/Object;)V
    //   38: goto +15 -> 53
    //   41: astore_2
    //   42: aload_0
    //   43: getfield 573	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:pendingLabelUpdates	Ljava/util/Set;
    //   46: invokeinterface 677 1 0
    //   51: aload_2
    //   52: athrow
    //   53: aload_0
    //   54: getfield 573	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:pendingLabelUpdates	Ljava/util/Set;
    //   57: invokeinterface 677 1 0
    //   62: return
    // Line number table:
    //   Java source line #274	-> byte code offset #0
    //   Java source line #276	-> byte code offset #11
    //   Java source line #277	-> byte code offset #33
    //   Java source line #278	-> byte code offset #41
    //   Java source line #279	-> byte code offset #42
    //   Java source line #280	-> byte code offset #51
    //   Java source line #279	-> byte code offset #53
    //   Java source line #281	-> byte code offset #62
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	63	0	this	SynchronizeModelUpdateHandler
    //   32	3	1	updates	Object[]
    //   41	11	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   11	41	41	finally
  }
  
  private void updateLabels(Object[] elements)
  {
    StructuredViewer tree = getViewer();
    if (Utils.canUpdateViewer(tree)) {
      tree.update(elements, null);
    }
  }
  
  public void updateParentLabels(ISynchronizeModelElement element)
  {
    queueForLabelUpdate(element);
    while (element.getParent() != null)
    {
      element = (ISynchronizeModelElement)element.getParent();
      queueForLabelUpdate(element);
    }
  }
  
  protected void queueForLabelUpdate(ISynchronizeModelElement diffNode)
  {
    pendingLabelUpdates.add(diffNode);
  }
  
  private void propagateProblemMarkers(ISynchronizeModelElement element)
  {
    IResource resource = element.getResource();
    if (resource != null)
    {
      String property = provider.calculateProblemMarker(element);
      
      boolean recalculateParentDecorations = hadProblemProperty(element, property);
      if (recalculateParentDecorations)
      {
        ISynchronizeModelElement parent = (ISynchronizeModelElement)element.getParent();
        if (parent != null) {
          propagateProblemMarkers(parent);
        }
      }
    }
  }
  
  private boolean hadProblemProperty(ISynchronizeModelElement element, String property)
  {
    boolean hadError = element.getProperty("org.eclipse.team.ui.error");
    boolean hadWarning = element.getProperty("org.eclipse.team.ui.warning");
    
    IResource resource = element.getResource();
    if ((resource != null) && (resource.isPhantom())) {
      return true;
    }
    if (hadError)
    {
      if (property != "org.eclipse.team.ui.error")
      {
        element.setPropertyToRoot("org.eclipse.team.ui.error", false);
        if (property != null) {
          element.setPropertyToRoot(property, true);
        }
        return true;
      }
      return false;
    }
    if (hadWarning)
    {
      if (property != "org.eclipse.team.ui.warning")
      {
        element.setPropertyToRoot("org.eclipse.team.ui.warning", false);
        if (property != null)
        {
          element.setPropertyToRoot(property, true);
          return false;
        }
        return true;
      }
      return false;
    }
    if (property == "org.eclipse.team.ui.error")
    {
      element.setPropertyToRoot(property, true);
      return false;
    }
    if (property == "org.eclipse.team.ui.warning")
    {
      element.setPropertyToRoot(property, true);
      return true;
    }
    return false;
  }
  
  private void reset()
  {
    queueEvent(new BackgroundEventHandler.ResourceEvent(ROOT, 3, 2), false);
  }
  
  public void dispose()
  {
    shutdown();
    ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
    provider.getSyncInfoSet().removeSyncSetChangedListener(this);
  }
  
  protected long getShortDispatchDelay()
  {
    if (dispatchEarly)
    {
      dispatchEarly = false;
      return 100L;
    }
    return super.getShortDispatchDelay();
  }
  
  public void nodeAdded(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider)
  {
    element.addPropertyChangeListener(listener);
    this.provider.nodeAdded(element, provider);
    if (DEBUG) {
      System.out.println("Node added: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider));
    }
  }
  
  public void nodeRemoved(ISynchronizeModelElement element, AbstractSynchronizeModelProvider provider)
  {
    element.removePropertyChangeListener(listener);
    this.provider.nodeRemoved(element, provider);
    if (DEBUG) {
      System.out.println("Node removed: " + getDebugDisplayLabel(element) + " -> " + getDebugDisplayLabel((ISynchronizeModelElement)element.getParent()) + " : " + getDebugDisplayLabel(provider));
    }
  }
  
  public void modelObjectCleared(ISynchronizeModelElement node)
  {
    node.removePropertyChangeListener(listener);
    provider.modelObjectCleared(node);
    if (DEBUG) {
      System.out.println("Node cleared: " + getDebugDisplayLabel(node));
    }
  }
  
  private String getDebugDisplayLabel(ISynchronizeModelElement node)
  {
    if (node == null) {
      return "ROOT";
    }
    if (node.getResource() != null) {
      return node.getResource().getFullPath().toString();
    }
    return node.getName();
  }
  
  private String getDebugDisplayLabel(AbstractSynchronizeModelProvider provider2)
  {
    return provider2.toString();
  }
  
  public void syncInfoSetReset(SyncInfoSet set, IProgressMonitor monitor)
  {
    if (provider.isDisposed()) {
      set.removeSyncSetChangedListener(this);
    } else {
      reset();
    }
  }
  
  public void syncInfoChanged(ISyncInfoSetChangeEvent event, IProgressMonitor monitor)
  {
    if (!(event instanceof ISyncInfoTreeChangeEvent)) {
      reset();
    } else {
      queueEvent(new SyncInfoSetChangeEvent(event), false);
    }
  }
  
  private void handleChanges(ISyncInfoSetChangeEvent event, IProgressMonitor monitor)
  {
    runViewUpdate(new Runnable()
    {
      private final ISyncInfoSetChangeEvent val$event;
      private final IProgressMonitor val$monitor;
      
      public void run()
      {
        provider.handleChanges((ISyncInfoTreeChangeEvent)val$event, val$monitor);
        firePendingLabelUpdates();
      }
    }, true);
  }
  
  public void syncInfoSetErrors(SyncInfoSet set, ITeamStatus[] errors, IProgressMonitor monitor) {}
  
  public ISynchronizeModelProvider getProvider()
  {
    return provider;
  }
  
  public void connect(IProgressMonitor monitor)
  {
    getProvider().getSyncInfoSet().connect(this, monitor);
  }
  
  public void runViewUpdate(Runnable runnable, boolean preserveExpansion)
  {
    if ((Utils.canUpdateViewer(getViewer())) || (isPerformingBackgroundUpdate()))
    {
      internalRunViewUpdate(runnable, preserveExpansion);
    }
    else
    {
      if (Thread.currentThread() != getEventHandlerJob().getThread()) {
        TeamUIPlugin.log(2, "View update invoked from invalid thread", new TeamException("View update invoked from invalid thread"));
      }
      Control ctrl = getViewer().getControl();
      if ((ctrl != null) && (!ctrl.isDisposed())) {
        ctrl.getDisplay().syncExec(new Runnable()
        {
          private final Control val$ctrl;
          private final Runnable val$runnable;
          private final boolean val$preserveExpansion;
          
          public void run()
          {
            if (!val$ctrl.isDisposed()) {
              BusyIndicator.showWhile(val$ctrl.getDisplay(), new SynchronizeModelUpdateHandler.5(this, val$runnable, val$preserveExpansion));
            }
          }
        });
      }
    }
  }
  
  public boolean isPerformingBackgroundUpdate()
  {
    return (Thread.currentThread() == getEventHandlerJob().getThread()) && (performingBackgroundUpdate);
  }
  
  /* Error */
  private void internalRunViewUpdate(Runnable runnable, boolean preserveExpansion)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 641	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:getViewer	()Lorg/eclipse/jface/viewers/StructuredViewer;
    //   4: astore_3
    //   5: aconst_null
    //   6: checkcast 272	[Lorg/eclipse/core/resources/IResource;
    //   9: astore 4
    //   11: aconst_null
    //   12: checkcast 272	[Lorg/eclipse/core/resources/IResource;
    //   15: astore 5
    //   17: aload_3
    //   18: invokestatic 613	org/eclipse/team/internal/ui/Utils:canUpdateViewer	(Lorg/eclipse/jface/viewers/StructuredViewer;)Z
    //   21: ifeq +58 -> 79
    //   24: aload_3
    //   25: invokevirtual 595	org/eclipse/jface/viewers/StructuredViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   28: iconst_0
    //   29: invokevirtual 598	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   32: iload_2
    //   33: ifeq +21 -> 54
    //   36: aload_0
    //   37: getfield 576	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:provider	Lorg/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider;
    //   40: invokevirtual 618	org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider:getExpandedResources	()[Lorg/eclipse/core/resources/IResource;
    //   43: astore 4
    //   45: aload_0
    //   46: getfield 576	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:provider	Lorg/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider;
    //   49: invokevirtual 619	org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider:getSelectedResources	()[Lorg/eclipse/core/resources/IResource;
    //   52: astore 5
    //   54: aload_3
    //   55: instanceof 299
    //   58: ifeq +21 -> 79
    //   61: aload_0
    //   62: getfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   65: ifnonnull +14 -> 79
    //   68: aload_0
    //   69: new 285	java/util/HashMap
    //   72: dup
    //   73: invokespecial 589	java/util/HashMap:<init>	()V
    //   76: putfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   79: aload_1
    //   80: invokeinterface 669 1 0
    //   85: goto +216 -> 301
    //   88: astore 6
    //   90: aload_3
    //   91: invokestatic 613	org/eclipse/team/internal/ui/Utils:canUpdateViewer	(Lorg/eclipse/jface/viewers/StructuredViewer;)Z
    //   94: ifeq +204 -> 298
    //   97: aload_0
    //   98: getfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   101: ifnull +145 -> 246
    //   104: aload_0
    //   105: getfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   108: invokeinterface 672 1 0
    //   113: ifne +133 -> 246
    //   116: aload_3
    //   117: invokestatic 613	org/eclipse/team/internal/ui/Utils:canUpdateViewer	(Lorg/eclipse/jface/viewers/StructuredViewer;)Z
    //   120: ifeq +126 -> 246
    //   123: aload_0
    //   124: getfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   127: invokeinterface 673 1 0
    //   132: invokeinterface 681 1 0
    //   137: astore 7
    //   139: goto +92 -> 231
    //   142: aload 7
    //   144: invokeinterface 671 1 0
    //   149: checkcast 328	org/eclipse/team/ui/synchronize/ISynchronizeModelElement
    //   152: astore 8
    //   154: getstatic 569	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:DEBUG	Z
    //   157: ifeq +32 -> 189
    //   160: getstatic 565	java/lang/System:out	Ljava/io/PrintStream;
    //   163: new 280	java/lang/StringBuffer
    //   166: dup
    //   167: ldc_w 263
    //   170: invokespecial 582	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   173: aload 8
    //   175: invokeinterface 692 1 0
    //   180: invokevirtual 584	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   183: invokevirtual 581	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   186: invokevirtual 579	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   189: aload_0
    //   190: getfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   193: aload 8
    //   195: invokeinterface 674 2 0
    //   200: checkcast 289	java/util/Set
    //   203: astore 9
    //   205: aload_3
    //   206: checkcast 299	org/eclipse/jface/viewers/AbstractTreeViewer
    //   209: aload 8
    //   211: aload 9
    //   213: aload 9
    //   215: invokeinterface 676 1 0
    //   220: anewarray 277	java/lang/Object
    //   223: invokeinterface 682 2 0
    //   228: invokevirtual 594	org/eclipse/jface/viewers/AbstractTreeViewer:add	(Ljava/lang/Object;[Ljava/lang/Object;)V
    //   231: aload 7
    //   233: invokeinterface 670 1 0
    //   238: ifne -96 -> 142
    //   241: aload_0
    //   242: aconst_null
    //   243: putfield 572	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:additionsMap	Ljava/util/Map;
    //   246: aload 4
    //   248: ifnull +12 -> 260
    //   251: aload_0
    //   252: getfield 576	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:provider	Lorg/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider;
    //   255: aload 4
    //   257: invokevirtual 620	org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider:expandResources	([Lorg/eclipse/core/resources/IResource;)V
    //   260: aload 5
    //   262: ifnull +28 -> 290
    //   265: aload_0
    //   266: getfield 576	org/eclipse/team/internal/ui/synchronize/SynchronizeModelUpdateHandler:provider	Lorg/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider;
    //   269: aload 5
    //   271: invokevirtual 621	org/eclipse/team/internal/ui/synchronize/AbstractSynchronizeModelProvider:selectResources	([Lorg/eclipse/core/resources/IResource;)V
    //   274: goto +16 -> 290
    //   277: astore 10
    //   279: aload_3
    //   280: invokevirtual 595	org/eclipse/jface/viewers/StructuredViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   283: iconst_1
    //   284: invokevirtual 598	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   287: aload 10
    //   289: athrow
    //   290: aload_3
    //   291: invokevirtual 595	org/eclipse/jface/viewers/StructuredViewer:getControl	()Lorg/eclipse/swt/widgets/Control;
    //   294: iconst_1
    //   295: invokevirtual 598	org/eclipse/swt/widgets/Control:setRedraw	(Z)V
    //   298: aload 6
    //   300: athrow
    //   301: aload_3
    //   302: invokestatic 613	org/eclipse/team/internal/ui/Utils:canUpdateViewer	(Lorg/eclipse/jface/viewers/StructuredViewer;)Z
    //   305: ifeq +204 -> 509
    // 
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

Further reading...

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

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd