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

escriptor(getModelProviderId()).getModelProvider();
    }
    catch (CoreException localCoreException)
    {
      throw new IllegalStateException();
    }
  }
  
  protected abstract String getModelProviderId();
  
  protected abstract Object getModelRoot();
  
  protected final Viewer getViewer()
  {
    return viewer;
  }
  
  protected Object[] getChildrenInScope(ISynchronizationScope scope, Object parent, Object[] children)
  {
    List result = new ArrayList();
    for (int i = 0; i < children.length; i++)
    {
      Object object = children[i];
      if ((object != null) && (isInScope(scope, parent, object))) {
        result.add(object);
      }
    }
    return result.toArray(new Object[result.size()]);
  }
  
  protected Object[] getChildrenInContext(ISynchronizationContext context, Object parent, Object[] children)
  {
    if (children.length != 0) {
      children = getChildrenInScope(context.getScope(), parent, children);
    }
    if ((parent instanceof IResource))
    {
      IResource resource = (IResource)parent;
      children = getChildrenWithPhantoms(context, resource, children);
    }
    if (children.length == 0) {
      return children;
    }
    return internalGetChildren(context, parent, children);
  }
  
  private Object[] getChildrenWithPhantoms(ISynchronizationContext context, IResource resource, Object[] children)
  {
    IResource[] setChildren = context.getDiffTree().members(resource);
    if (setChildren.length == 0) {
      return children;
    }
    if (children.length == 0) {
      return setChildren;
    }
    Set result = new HashSet(children.length);
    for (int i = 0; i < children.length; i++) {
      result.add(children[i]);
    }
    for (int i = 0; i < setChildren.length; i++) {
      result.add(setChildren[i]);
    }
    return result.toArray();
  }
  
  private Object[] internalGetChildren(ISynchronizationContext context, Object parent, Object[] children)
  {
    List result = new ArrayList(children.length);
    for (int i = 0; i < children.length; i++)
    {
      Object object = children[i];
      if ((parent instanceof TreePath))
      {
        TreePath tp = (TreePath)parent;
        object = tp.createChildPath(object);
      }
      if (isVisible(context, object)) {
        result.add(internalGetElement(object));
      }
    }
    return result.toArray(new Object[result.size()]);
  }
  
  protected boolean isVisible(ISynchronizationContext context, Object object)
  {
    ResourceTraversal[] traversals = getTraversals(context, object);
    IDiff[] deltas = context.getDiffTree().getDiffs(traversals);
    boolean visible = false;
    if (isVisible(deltas)) {
      visible = true;
    }
    return visible;
  }
  
  private boolean isVisible(IDiff[] diffs)
  {
    if (diffs.length > 0) {
      for (int j = 0; j < diffs.length; j++)
      {
        IDiff diff = diffs[j];
        if (isVisible(diff)) {
          return true;
        }
      }
    }
    return false;
  }
  
  protected boolean isVisible(IDiff diff)
  {
    if ((diff instanceof IThreeWayDiff))
    {
      IThreeWayDiff twd = (IThreeWayDiff)diff;
      return includeDirection(twd.getDirection());
    }
    return diff.getKind() != 0;
  }
  
  protected abstract ResourceTraversal[] getTraversals(ISynchronizationContext paramISynchronizationContext, Object paramObject);
  
  protected void handleException(CoreException e)
  {
    TeamPlugin.log(e);
  }
  
  protected boolean isInScope(ISynchronizationScope scope, Object parent, Object element)
  {
    ResourceMapping mapping = Utils.getResourceMapping(internalGetElement(element));
    if (mapping != null)
    {
      ResourceMapping[] mappings = scope.getMappings(mapping.getModelProviderId());
      for (int i = 0; i < mappings.length; i++)
      {
        ResourceMapping sm = mappings[i];
        if (mapping.contains(sm)) {
          return true;
        }
        if (sm.contains(mapping)) {
          return true;
        }
      }
    }
    return false;
  }
  
  public ICommonContentExtensionSite getExtensionSite()
  {
    return site;
  }
  
  private Object internalGetElement(Object elementOrPath)
  {
    if ((elementOrPath instanceof TreePath))
    {
      TreePath tp = (TreePath)elementOrPath;
      return tp.getLastSegment();
    }
    return elementOrPath;
  }
  
  protected final boolean isFlatLayout()
  {
    ISynchronizePageConfiguration c = getConfiguration();
    if (c != null)
    {
      String p = (String)c.getProperty("org.eclipse.team.ui.pageLayout");
      return (p != null) && (p.equals("org.eclipse.team.ui.flatLayout"));
    }
    return false;
  }
}

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

import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.ui.synchronize.AbstractSynchronizeLabelProvider;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;
import org.eclipse.ui.navigator.IDescriptionProvider;
import org.eclipse.ui.navigator.IExtensionStateModel;
import org.eclipse.ui.navigator.INavigatorContentExtension;

public abstract class SynchronizationLabelProvider
  extends AbstractSynchronizeLabelProvider
  implements ICommonLabelProvider, IFontProvider
{
  private ISynchronizationScope scope;
  private ISynchronizationContext context;
  private ITreeContentProvider contentProvider;
  private ICommonContentExtensionSite site;
  
  private void init(ISynchronizationScope input, ISynchronizationContext context)
  {
    scope = input;
    this.context = context;
  }
  
  public void init(ICommonContentExtensionSite site)
  {
    this.site = site;
    contentProvider = site.getExtension().getContentProvider();
    init((ISynchronizationScope)site.getExtensionStateModel().getProperty("org.eclipse.team.ui.synchronizationScope"), 
      (ISynchronizationContext)site.getExtensionStateModel().getProperty("org.eclipse.team.ui.synchronizationContext"));
  }
  
  public ISynchronizationContext getContext()
  {
    return context;
  }
  
  public ISynchronizationScope getScope()
  {
    return scope;
  }
  
  public void restoreState(IMemento aMemento)
  {
    ILabelProvider provider = getDelegateLabelProvider();
    if ((provider instanceof ICommonLabelProvider)) {
      ((ICommonLabelProvider)provider).restoreState(aMemento);
    }
  }
  
  public void saveState(IMemento aMemento)
  {
    ILabelProvider provider = getDelegateLabelProvider();
    if ((provider instanceof ICommonLabelProvider)) {
      ((ICommonLabelProvider)provider).saveState(aMemento);
    }
  }
  
  public String getDescription(Object anElement)
  {
    ILabelProvider provider = getDelegateLabelProvider();
    if ((provider instanceof IDescriptionProvider)) {
      return ((IDescriptionProvider)provider).getDescription(internalGetElement(anElement));
    }
    return null;
  }
  
  protected boolean isDecorationEnabled()
  {
    return getContext() != null;
  }
  
  public Image getImage(Object element)
  {
    Image image = super.getImage(element);
    if ((image == null) && ((internalGetElement(element) instanceof ModelProvider))) {
      image = super.getImage(getModelRoot());
    }
    return image;
  }
  
  protected Object getModelRoot()
  {
    return ResourcesPlugin.getWorkspace().getRoot();
  }
  
  public String getText(Object element)
  {
    String text = super.getText(element);
    if ((contentProvider instanceof SynchronizationContentProvider))
    {
      SynchronizationContentProvider scp = (SynchronizationContentProvider)contentProvider;
      ISynchronizationContext context = getContext();
      if ((context != null) && (!scp.isInitialized(context))) {
        return NLS.bind(TeamUIMessages.SynchronizationLabelProvider_0, text);
      }
    }
    return text;
  }
  
  public ICommonContentExtensionSite getExtensionSite()
  {
    return site;
  }
  
  private Object internalGetElement(Object element)
  {
    if ((element instanceof TreePath))
    {
      TreePath tp = (TreePath)element;
      element = tp.getLastSegment();
    }
    return element;
  }
}

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

import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.ISynchronizationContext;

class SynchronizationOperation$1
  extends JobChangeAdapter
{
  final SynchronizationOperation this$0;
  private final IJobManager val$jobManager;
  
  SynchronizationOperation$1(SynchronizationOperation paramSynchronizationOperation, IJobManager paramIJobManager)
  {
    this$0 = paramSynchronizationOperation;val$jobManager = paramIJobManager;
  }
  
  public void done(IJobChangeEvent event)
  {
    Job[] jobs = val$jobManager.find(this$0.getContext());
    if (jobs.length == 0)
    {
      IResourceDiffTree diffTree = this$0.getContext().getDiffTree();
      diffTree.clearBusy(null);
      val$jobManager.removeJobChangeListener(this);
    }
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.IJobManager;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.TeamOperation;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.ui.IWorkbenchPart;

public abstract class SynchronizationOperation
  extends TeamOperation
{
  private final ISynchronizePageConfiguration configuration;
  private final Object[] elements;
  
  private static IWorkbenchPart getPart(ISynchronizePageConfiguration configuration)
  {
    if (configuration != null)
    {
      ISynchronizePageSite site = configuration.getSite();
      if (site != null) {
        return site.getPart();
      }
    }
    return null;
  }
  
  protected SynchronizationOperation(ISynchronizePageConfiguration configuration, Object[] elements)
  {
    super(getPart(configuration), configuration.getRunnableContext());
    this.configuration = configuration;
    this.elements = elements;
  }
  
  public ISynchronizePageConfiguration getConfiguration()
  {
    return configuration;
  }
  
  protected ISynchronizationContext getContext()
  {
    return (ISynchronizationContext)getConfiguration().getProperty("org.eclipse.team.ui.synchronizationContext");
  }
  
  public Object[] getElements()
  {
    return elements;
  }
  
  public boolean shouldRun()
  {
    return super.shouldRun();
  }
  
  public SaveableComparison getSaveable()
  {
    return null;
  }
  
  /* Error */
  public final void run(IProgressMonitor monitor)
    throws InvocationTargetException, InterruptedException
  {
    // Byte code:
    //   0: aload_1
    //   1: aconst_null
    //   2: bipush 100
    //   4: invokeinterface 148 3 0
    //   9: aload_0
    //   10: aload_1
    //   11: iconst_5
    //   12: invokestatic 134	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   15: invokespecial 142	org/eclipse/team/ui/mapping/SynchronizationOperation:setContextBusy	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   18: aload_0
    //   19: aload_1
    //   20: bipush 90
    //   22: invokestatic 134	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   25: invokevirtual 141	org/eclipse/team/ui/mapping/SynchronizationOperation:execute	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   28: goto +21 -> 49
    //   31: astore_2
    //   32: aload_0
    //   33: aload_1
    //   34: iconst_5
    //   35: invokestatic 134	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   38: invokespecial 140	org/eclipse/team/ui/mapping/SynchronizationOperation:clearContextBusy	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   41: aload_1
    //   42: invokeinterface 147 1 0
    //   47: aload_2
    //   48: athrow
    //   49: aload_0
    //   50: aload_1
    //   51: iconst_5
    //   52: invokestatic 134	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   55: invokespecial 140	org/eclipse/team/ui/mapping/SynchronizationOperation:clearContextBusy	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   58: aload_1
    //   59: invokeinterface 147 1 0
    //   64: return
    // Line number table:
    //   Java source line #119	-> byte code offset #0
    //   Java source line #120	-> byte code offset #9
    //   Java source line #121	-> byte code offset #18
    //   Java source line #122	-> byte code offset #31
    //   Java source line #123	-> byte code offset #32
    //   Java source line #124	-> byte code offset #41
    //   Java source line #125	-> byte code offset #47
    //   Java source line #123	-> byte code offset #49
    //   Java source line #124	-> byte code offset #58
    //   Java source line #126	-> byte code offset #64
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	65	0	this	SynchronizationOperation
    //   0	65	1	monitor	IProgressMonitor
    //   31	17	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	31	31	finally
  }
  
  private void clearContextBusy(IProgressMonitor monitor)
  {
    IJobManager jobManager = Job.getJobManager();
    IJobChangeListener listener = new JobChangeAdapter()
    {
      private final IJobManager val$jobManager;
      
      public void done(IJobChangeEvent event)
      {
        Job[] jobs = val$jobManager.find(getContext());
        if (jobs.length == 0)
        {
          IResourceDiffTree diffTree = getContext().getDiffTree();
          diffTree.clearBusy(null);
          val$jobManager.removeJobChangeListener(this);
        }
      }
    };
    jobManager.addJobChangeListener(listener);
  }
  
  private void setContextBusy(IProgressMonitor monitor)
  {
    try
    {
      ResourceTraversal[] traversals = Utils.getTraversals(getElements());
      IResourceDiffTree diffTree = getContext().getDiffTree();
      IDiff[] diffs = diffTree.getDiffs(traversals);
      diffTree.setBusy(diffs, monitor);
    }
    catch (CoreException e)
    {
      TeamUIPlugin.log(e);
    }
  }
  
  protected abstract void execute(IProgressMonitor paramIProgressMonitor)
    throws InvocationTargetException, InterruptedException;
}

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

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ui.TeamUIPlugin;

public class SynchronizationStateTester
{
  public static final String PROP_TESTER = "org.eclipse.team.ui.syncStateTester";
  
  public boolean isStateDecorationEnabled()
  {
    return true;
  }
  
  public boolean isDecorationEnabled(Object element)
  {
    return isStateDecorationEnabled();
  }
  
  public int getState(Object element, int stateMask, IProgressMonitor monitor)
    throws CoreException
  {
    ITeamStateDescription desc = getTeamStateProvider().getStateDescription(element, stateMask, new String[0], monitor);
    if (desc != null) {
      return desc.getStateFlags();
    }
    return 0;
  }
  
  public final ITeamStateProvider getTeamStateProvider()
  {
    return TeamUIPlugin.getPlugin().getDecoratedStateProvider();
  }
  
  public void elementDecorated(Object element, ITeamStateDescription description) {}
}

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

import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.DecorationOverlayIcon;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.diff.IThreeWayDiff;
import org.eclipse.team.core.mapping.ISynchronizationContext;
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.internal.ui.mapping.ResourceDiffCompareInput;
import org.eclipse.team.internal.ui.synchronize.ImageManager;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.mapping.ITeamContentProviderDescriptor;
import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
import org.eclipse.team.ui.mapping.SynchronizationLabelProvider;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.IExtensionStateModel;

public abstract class AbstractSynchronizeLabelProvider
  implements ILabelProvider
{
  private ImageManager localImageManager;
  
  public Image getImage(Object element)
  {
    Image base = getDelegateImage(element);
    if ((isDecorationEnabled()) && (base != null))
    {
      Image decorateImage = decorateImage(base, element);
      base = decorateImage;
    }
    if ((isIncludeOverlays()) && (base != null)) {
      base = addOverlays(base, element);
    }
    return base;
  }
  
  protected Image decorateImage(Image base, Object element)
  {
    Image decoratedImage;
    Image decoratedImage;
    if ((element instanceof ICompareInput))
    {
      ICompareInput ci = (ICompareInput)element;
      decoratedImage = getCompareImage(base, ci.getKind());
    }
    else
    {
      IDiff node = getDiff(element);
      decoratedImage = getCompareImage(base, node);
    }
    return decoratedImage;
  }
  
  protected Image getDelegateImage(Object element)
  {
    ILabelProvider modelLabelProvider = getDelegateLabelProvider();
    Image base = modelLabelProvider.getImage(internalGetElement(element));
    if ((base == null) && ((element instanceof ModelProvider)))
    {
      ModelProvider mp = (ModelProvider)element;
      base = getImageManager().getImage(getImageDescriptor(mp));
    }
    return base;
  }
  
  private ImageDescriptor getImageDescriptor(ModelProvider provider)
  {
    ITeamContentProviderManager manager = TeamUI.getTeamContentProviderManager();
    ITeamContentProviderDescriptor desc = manager.getDescriptor(provider.getId());
    return desc.getImageDescriptor();
  }
  
  private Object internalGetElement(Object element)
  {
    if ((element instanceof TreePath))
    {
      TreePath tp = (TreePath)element;
      element = tp.getLastSegment();
    }
    return element;
  }
  
  private Image getCompareImage(Image base, IDiff node)
  {
    int compareKind = getCompareKind(node);
    return getCompareImage(base, compareKind);
  }
  
  protected Image getCompareImage(Image base, int compareKind)
  {
    return getImageManager().getImage(base, compareKind);
  }
  
  private int getCompareKind(IDiff node)
  {
    return ResourceDiffCompareInput.getCompareKind(node);
  }
  
  public String getText(Object element)
  {
    String base = getDelegateText(element);
    if (isSyncInfoInTextEnabled()) {
      return decorateText(base, element);
    }
    return base;
  }
  
  protected String getDelegateText(Object element)
  {
    ILabelProvider modelLabelProvider = getDelegateLabelProvider();
    element = internalGetElement(element);
    String base = modelLabelProvider.getText(element);
    if (((base == null) || (base.length() == 0)) && 
      ((element instanceof ModelProvider)))
    {
      ModelProvider provider = (ModelProvider)element;
      base = Utils.getLabel(provider);
    }
    return base;
  }
  
  protected String decorateText(String base, Object element)
  {
    IDiff node = getDiff(element);
    if ((node != null) && (node.getKind() != 0))
    {
      String syncKindString = node.toDiffString();
      return NLS.bind(TeamUIMessages.AbstractSynchronizationLabelProvider_0, new String[] { base, syncKindString });
    }
    return base;
  }
  
  public void addListener(ILabelProviderListener listener)
  {
    getDelegateLabelProvider().addListener(listener);
  }
  
  public void dispose()
  {
    if (localImageManager != null) {
      localImageManager.dispose();
    }
  }
  
  public boolean isLabelProperty(Object element, String property)
  {
    return getDelegateLabelProvider().isLabelProperty(internalGetElement(element), property);
  }
  
  public void removeListener(ILabelProviderListener listener)
  {
    getDelegateLabelProvider().removeListener(listener);
  }
  
  protected boolean isSyncInfoInTextEnabled()
  {
    return (isDecorationEnabled()) && (TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean("org.eclipse.team.ui.view_syncinfo_in_label"));
  }
  
  protected abstract ILabelProvider getDelegateLabelProvider();
  
  protected abstract boolean isDecorationEnabled();
  
  protected IDiff getDiff(Object element)
  {
    return null;
  }
  
  private Image addOverlays(Image base, Object element)
  {
    if (!isIncludeOverlays()) {
      return base;
    }
    ImageDescriptor[] overlayImages = new ImageDescriptor[4];
    boolean hasOverlay = false;
    if (isBusy(element))
    {
      overlayImages[0] = TeamUIPlugin.getImageDescriptor("ovr/waiting_ovr.gif");
      hasOverlay = true;
    }
    if (!isConflicting(element)) {
      if (hasDecendantConflicts(element))
      {
        overlayImages[3] = TeamUIPlugin.getImageDescriptor("ovr/confchg_ov.gif");
        hasOverlay = true;
      }
    }
    int severity = getMarkerSeverity(element);
    if (severity == 2)
    {
      overlayImages[2] = TeamUIPlugin.getImageDescriptor("ovr/error_co.gif");
      hasOverlay = true;
    }
    else if (severity == 1)
    {
      overlayImages[2] = TeamUIPlugin.getImageDescriptor("ovr/warning_co.gif");
      hasOverlay = true;
    }
    if (hasOverlay)
    {
      ImageDescriptor overlay = new DecorationOverlayIcon(base, overlayImages, new Point(getBoundswidth, getBoundsheight));
      return getImageManager().getImage(overlay);
    }
    return base;
  }
  
  protected boolean isIncludeOverlays()
  {
    return false;
  }
  
  protected int getMarkerSeverity(Object element)
  {
    ResourceMapping mapping = Utils.getResourceMapping(internalGetElement(element));
    int result = -1;
    if (mapping != null) {
      try
      {
        IMarker[] markers = mapping.findMarkers("org.eclipse.core.resources.problemmarker", true, null);
        for (int i = 0; i < markers.length; i++)
        {
          IMarker marker = markers[i];
          Integer severity = (Integer)marker.getAttribute("severity");
          if (severity != null)
          {
            if (severity.intValue() == 2) {
              return 2;
            }
            if (severity.intValue() == 1) {
              result = 1;
            }
          }
        }
      }
      catch (CoreException localCoreException) {}
    }
    return result;
  }
  
  protected boolean hasDecendantConflicts(Object element)
  {
    return false;
  }
  
  private boolean isConflicting(Object element)
  {
    IDiff node = getDiff(element);
    if ((node != null) && 
      ((node instanceof IThreeWayDiff)))
    {
      IThreeWayDiff twd = (IThreeWayDiff)node;
      return twd.getDirection() == 768;
    }
    return false;
  }
  
  protected boolean isBusy(Object element)
  {
    return false;
  }
  
  public Font getFont(Object element)
  {
    if (isBusy(internalGetElement(element))) {
      return JFaceResources.getFontRegistry().getItalic("org.eclipse.jface.defaultfont");
    }
    return null;
  }
  
  private ImageManager getImageManager()
  {
    ISynchronizationContext context = getContext();
    if (context != null) {
      return ImageManager.getImageManager(context, getConfiguration());
    }
    if (localImageManager == null) {
      localImageManager = new ImageManager();
    }
    return localImageManager;
  }
  
  private ISynchronizePageConfiguration getConfiguration()
  {
    if ((this instanceof SynchronizationLabelProvider))
    {
      SynchronizationLabelProvider slp = (SynchronizationLabelProvider)this;
      return (ISynchronizePageConfiguration)slp.getExtensionSite().getExtensionStateModel().getProperty("org.eclipse.team.ui.synchronizationPageConfiguration");
    }
    return null;
  }
  
  private ISynchronizationContext getContext()
  {
    if ((this instanceof SynchronizationLabelProvider))
    {
      SynchronizationLabelProvider slp = (SynchronizationLabelProvider)this;
      return slp.getContext();
    }
    return null;
  }
}

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

import org.eclipse.compare.CompareConfiguration;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.PropertyChangeHandler;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage;
import org.eclipse.team.internal.ui.registry.SynchronizeParticipantDescriptor;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.PartInitException;

public abstract class AbstractSynchronizeParticipant
  extends PlatformObject
  implements ISynchronizeParticipant
{
  public static final String P_PINNED = "org.eclipse.team.pinned";
  public static final String P_SCHEDULED = "org.eclipse.team.schedule";
  private static final String CTX_PINNED = "root";
  private PropertyChangeHandler fChangeHandler;
  private String fName;
  private String fId;
  private String fSecondaryId;
  private boolean pinned;
  private ImageDescriptor fImageDescriptor;
  private String fHelpContextId;
  protected IConfigurationElement configElement;
  
  public String getName()
  {
    return fName;
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return fImageDescriptor;
  }
  
  public String getId()
  {
    return fId;
  }
  
  public String getSecondaryId()
  {
    return fSecondaryId;
  }
  
  public String getHelpContextId()
  {
    return fHelpContextId == null ? "org.eclipse.team.ui.sync_view_context" : 
      fHelpContextId;
  }
  
  public final void setPinned(boolean pinned)
  {
    this.pinned = pinned;
    pinned(pinned);
    firePropertyChange(this, "org.eclipse.team.pinned", Boolean.valueOf(!pinned), Boolean.valueOf(pinned));
  }
  
  public final boolean isPinned()
  {
    return pinned;
  }
  
  protected void pinned(boolean pinned) {}
  
  public boolean equals(Object obj)
  {
    if (obj == this) {
      return true;
    }
    if (!(obj instanceof ISynchronizeParticipant)) {
      return false;
    }
    ISynchronizeParticipant other = (ISynchronizeParticipant)obj;
    return (getId().equals(other.getId())) && (Utils.equalObject(getSecondaryId(), other.getSecondaryId()));
  }
  
  public int hashCode()
  {
    return Utils.getKey(getId(), getSecondaryId()).hashCode();
  }
  
  public boolean doesSupportSynchronize()
  {
    return true;
  }
  
  public synchronized void addPropertyChangeListener(IPropertyChangeListener listener)
  {
    if (fChangeHandler == null) {
      fChangeHandler = new PropertyChangeHandler();
    }
    fChangeHandler.addPropertyChangeListener(listener);
  }
  
  public void removePropertyChangeListener(IPropertyChangeListener listener)
  {
    if (fChangeHandler != null) {
      fChangeHandler.removePropertyChangeListener(listener);
    }
  }
  
  public void firePropertyChange(Object source, String property, Object oldValue, Object newValue)
  {
    if (fChangeHandler == null) {
      return;
    }
    fChangeHandler.firePropertyChange(source, property, oldValue, newValue);
  }
  
  public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
    throws CoreException
  {
    configElement = config;
    
    fId = config.getAttribute("id");
    
    fName = config.getAttribute("name");
    if (fName == null) {
      fName = "Unknown";
    }
    String strIcon = config.getAttribute("icon");
    if (strIcon != null) {
      fImageDescriptor = TeamImages.getImageDescriptorFromExtension(configElement.getDeclaringExtension(), strIcon);
    }
    fHelpContextId = configElement
      .getAttribute("helpContextId");
  }
  
  protected void setInitializationData(ISynchronizeParticipantDescriptor descriptor)
    throws CoreException
  {
    if ((descriptor instanceof SynchronizeParticipantDescriptor)) {
      setInitializationData(((SynchronizeParticipantDescriptor)descriptor).getConfigurationElement(), null, null);
    } else {
      throw new TeamException(TeamUIMessages.AbstractSynchronizeParticipant_4);
    }
  }
  
  protected void setName(String name)
  {
    String old = fName;
    fName = name;
    firePropertyChange(this, "org.eclipse.jface.text", old, name);
  }
  
  protected void setImageDescriptor(ImageDescriptor imageDescriptor)
  {
    ImageDescriptor old = fImageDescriptor;
    fImageDescriptor = imageDescriptor;
    firePropertyChange(this, "org.eclipse.jface.image", old, imageDescriptor);
  }
  
  protected void setSecondaryId(String secondaryId)
  {
    fSecondaryId = secondaryId;
  }
  
  public void init(String secondaryId, IMemento memento)
    throws PartInitException
  {
    setSecondaryId(secondaryId);
    pinned = Boolean.valueOf(memento.getString("root")).booleanValue();
  }
  
  public void saveState(IMemento memento)
  {
    memento.putString("root", Boolean.toString(pinned));
  }
  
  public final ISynchronizePageConfiguration createPageConfiguration()
  {
    SynchronizePageConfiguration configuration = new SynchronizePageConfiguration(this);
    if (isViewerContributionsSupported()) {
      configuration.setProperty("org.eclipse.team.ui.P_OBJECT_CONTRIBUTION_ID", getId());
    }
    initializeConfiguration(configuration);
    return configuration;
  }
  
  protected abstract void initializeConfiguration(ISynchronizePageConfiguration paramISynchronizePageConfiguration);
  
  public void prepareCompareInput(ISynchronizeModelElement element, CompareConfiguration config, IProgressMonitor monitor)
    throws TeamException
  {
    SyncInfo sync = getSyncInfo(element);
    if (sync != null) {
      Utils.updateLabels(sync, config, monitor);
    }
    if ((element instanceof SyncInfoModelElement))
    {
      SyncInfoModelElement node = (SyncInfoModelElement)element;
      node.cacheContents(monitor);
    }
  }
  
  private SyncInfo getSyncInfo(ISynchronizeModelElement element)
  {
    if ((element instanceof IAdaptable)) {
      return (SyncInfo)((IAdaptable)element).getAdapter(SyncInfo.class);
    }
    return null;
  }
  
  public PreferencePage[] getPreferencePages()
  {
    return new PreferencePage[] { new SyncViewerPreferencePage() };
  }
  
  protected boolean isViewerContributionsSupported()
  {
    return false;
  }
}

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

import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable;

class AbstractSynchronizeScope$1
  extends SafeRunnable
{
  final AbstractSynchronizeScope this$0;
  private final IPropertyChangeListener val$listener;
  private final PropertyChangeEvent val$event;
  
  AbstractSynchronizeScope$1(AbstractSynchronizeScope paramAbstractSynchronizeScope, IPropertyChangeListener paramIPropertyChangeListener, PropertyChangeEvent paramPropertyChangeEvent)
  {
    this$0 = paramAbstractSynchronizeScope;val$listener = paramIPropertyChangeListener;val$event = paramPropertyChangeEvent;
  }
  
  public void run()
    throws Exception
  {
    val$listener.propertyChange(val$event);
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.ui.IMemento;

public abstract class AbstractSynchronizeScope
  implements ISynchronizeScope
{
  private static final String CTX_SUBSCRIBER_SCOPE_TYPE = "org.eclipse.team.ui.SCOPE_TYPE";
  private ListenerList listeners = new ListenerList(1);
  
  protected static void saveScope(ISynchronizeScope scope, IMemento settings)
  {
    settings.putString("org.eclipse.team.ui.SCOPE_TYPE", getType(scope));
    ((AbstractSynchronizeScope)scope).saveState(settings);
  }
  
  protected static ISynchronizeScope createScope(IMemento settings)
  {
    String type = settings.getString("org.eclipse.team.ui.SCOPE_TYPE");
    if (type == null) {
      return new WorkspaceScope();
    }
    if (type.equals("ResourceScope")) {
      return new ResourceScope(settings);
    }
    if (type.equals("WorkingSetScope")) {
      return new WorkingSetScope(settings);
    }
    return new WorkspaceScope();
  }
  
  private static String getType(ISynchronizeScope scope)
  {
    String name = scope.getClass().getName();
    int lastDot = name.lastIndexOf(".");
    if (lastDot == -1) {
      return name;
    }
    return name.substring(lastDot + 1);
  }
  
  protected AbstractSynchronizeScope() {}
  
  protected AbstractSynchronizeScope(IMemento memento)
  {
    init(memento);
  }
  
  public void addPropertyChangeListener(IPropertyChangeListener listener)
  {
    synchronized (listeners)
    {
      listeners.add(listener);
    }
  }
  
  public void removePropertyChangeListener(IPropertyChangeListener listener)
  {
    synchronized (listeners)
    {
      listeners.remove(listeners);
    }
  }
  
  public void dispose() {}
  
  protected void firePropertyChangedEvent(PropertyChangeEvent event)
  {
    Object[] allListeners;
    synchronized (listeners)
    {
      allListeners = listeners.getListeners();
    }
    Object[] allListeners;
    for (int i = 0; i < allListeners.length; i++)
    {
      IPropertyChangeListener listener = (IPropertyChangeListener)allListeners[i];
      SafeRunner.run(new SafeRunnable()
      {
        private final IPropertyChangeListener val$listener;
        private final PropertyChangeEvent val$event;
        
        public void run()
          throws Exception
        {
          val$listener.propertyChange(val$event);
        }
      });
    }
  }
  
  protected void fireRootsChanges()
  {
    firePropertyChangedEvent(new PropertyChangeEvent(this, "prop_roots", new IResource[0], getRoots()));
  }
  
  public void saveState(IMemento memento) {}
  
  protected void init(IMemento memento) {}
  
  public boolean contains(IResource resource)
  {
    IResource[] roots = getRoots();
    IPath resourcePath = resource.getFullPath();
    for (int i = 0; i < roots.length; i++)
    {
      IResource root = roots[i];
      if (root.getFullPath().isPrefixOf(resourcePath)) {
        return true;
      }
    }
    return false;
  }
  
  public ResourceMapping[] getMappings()
  {
    List result = new ArrayList();
    IResource[] roots = getRoots();
    for (int i = 0; i < roots.length; i++)
    {
      IResource resource = roots[i];
      result.add(resource.getAdapter(ResourceMapping.class));
    }
    return (ResourceMapping[])result.toArray(new ResourceMapping[result.size()]);
  }
}

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

public abstract interface ISynchronizeManager
{
  public static final Object FAMILY_SYNCHRONIZE_OPERATION = new Object();
  
  public abstract void addSynchronizeParticipantListener(ISynchronizeParticipantListener paramISynchronizeParticipantListener);
  
  public abstract void removeSynchronizeParticipantListener(ISynchronizeParticipantListener paramISynchronizeParticipantListener);
  
  public abstract void addSynchronizeParticipants(ISynchronizeParticipant[] paramArrayOfISynchronizeParticipant);
  
  public abstract void removeSynchronizeParticipants(ISynchronizeParticipant[] paramArrayOfISynchronizeParticipant);
  
  public abstract ISynchronizeParticipantReference[] getSynchronizeParticipants();
  
  public abstract ISynchronizeParticipantReference[] get(String paramString);
  
  public abstract ISynchronizeParticipantReference get(String paramString1, String paramString2);
  
  public 
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