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

//   63: istore_3
    //   64: iload_3
    //   65: ifne +141 -> 206
    //   68: aload_0
    //   69: aload_0
    //   70: invokevirtual 344	org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider:getModelRoot	()Lorg/eclipse/team/ui/synchronize/ISynchronizeModelElement;
    //   73: invokespecial 348	org/eclipse/team/internal/ui/synchronize/ChangeSetModelProvider:getProviderRootedAt	(Lorg/eclipse/team/ui/synchronize/ISynchronizeModelElement;)Lorg/eclipse/team/internal/ui/synchronize/ISynchronizeModelProvider;
    //   76: astore 4
    //   78: aload 4
    //   80: ifnull +126 -> 206
    //   83: aload 4
    //   85: invokeinterface 383 1 0
    //   90: astore 5
    //   92: aload 5
    //   94: invokevirtual 317	org/eclipse/team/core/synchronize/SyncInfoSet:beginInput	()V
    //   97: aload 5
    //   99: aload_1
    //   100: invokeinterface 377 1 0
    //   105: invokevirtual 318	org/eclipse/team/core/synchronize/SyncInfoSet:removeAll	([Lorg/eclipse/core/resources/IResource;)V
    //   108: aload_1
    //   109: invokeinterface 378 1 0
    //   114: astore 6
    //   116: iconst_0
    //   117: istore 7
    //   119: goto +20 -> 139
    //   122: aload 6
    //   124: iload 7
    //   126: aaload
    //   127: astore 8
    //   129: aload 5
    //   131: aload 8
    //   133: invokevirtual 320	org/eclipse/team/core/synchronize/SyncInfoSet:add	(Lorg/eclipse/team/core/synchronize/SyncInfo;)V
    //   136: iinc 7 1
    //   139: iload 7
    //   141: aload 6
    //   143: arraylength
    //   144: if_icmplt -22 -> 122
    //   147: aload_1
    //   148: invokeinterface 379 1 0
    //   153: astore 7
    //   155: iconst_0
    //   156: istore 8
    //   158: goto +20 -> 178
    //   161: aload 7
    //   163: iload 8
    //   165: aaload
    //   166: astore 9
    //   168: aload 5
    //   170: aload 9
    //   172: invokevirtual 320	org/eclipse/team/core/synchronize/SyncInfoSet:add	(Lorg/eclipse/team/core/synchronize/SyncInfo;)V
    //   175: iinc 8 1
    //   178: iload 8
    //   180: aload 7
    //   182: arraylength
    //   183: if_icmplt -22 -> 161
    //   186: goto +14 -> 200
    //   189: astore 10
    //   191: aload 5
    //   193: aload_2
    //   194: invokevirtual 319	org/eclipse/team/core/synchronize/SyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   197: aload 10
    //   199: athrow
    //   200: aload 5
    //   202: aload_2
    //   203: invokevirtual 319	org/eclipse/team/core/synchronize/SyncInfoSet:endInput	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   206: return
    // Line number table:
    //   Java source line #132	-> byte code offset #0
    //   Java source line #133	-> byte code offset #2
    //   Java source line #134	-> byte code offset #23
    //   Java source line #135	-> byte code offset #31
    //   Java source line #137	-> byte code offset #33
    //   Java source line #138	-> byte code offset #54
    //   Java source line #139	-> byte code offset #62
    //   Java source line #141	-> byte code offset #64
    //   Java source line #143	-> byte code offset #68
    //   Java source line #144	-> byte code offset #78
    //   Java source line #145	-> byte code offset #83
    //   Java source line #147	-> byte code offset #92
    //   Java source line #148	-> byte code offset #97
    //   Java source line #149	-> byte code offset #108
    //   Java source line #150	-> byte code offset #116
    //   Java source line #151	-> byte code offset #122
    //   Java source line #152	-> byte code offset #129
    //   Java source line #150	-> byte code offset #136
    //   Java source line #154	-> byte code offset #147
    //   Java source line #155	-> byte code offset #155
    //   Java source line #156	-> byte code offset #161
    //   Java source line #157	-> byte code offset #168
    //   Java source line #155	-> byte code offset #175
    //   Java source line #159	-> byte code offset #189
    //   Java source line #160	-> byte code offset #191
    //   Java source line #161	-> byte code offset #197
    //   Java source line #160	-> byte code offset #200
    //   Java source line #164	-> byte code offset #206
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	207	0	this	ChangeSetModelProvider
    //   0	207	1	event	org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent
    //   0	207	2	monitor	IProgressMonitor
    //   1	64	3	handled	boolean
    //   76	8	4	provider	ISynchronizeModelProvider
    //   90	111	5	set	SyncInfoSet
    //   114	28	6	added	SyncInfo[]
    //   117	23	7	i	int
    //   153	28	7	changed	SyncInfo[]
    //   127	5	8	info	SyncInfo
    //   156	23	8	i	int
    //   166	5	9	info	SyncInfo
    //   189	9	10	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   92	189	189	finally
  }
  
  protected void handleAddition(SyncInfo info) {}
  
  protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node)
  {
    if (node == getModelRoot())
    {
      if (checkedInCollector != null)
      {
        checkedInCollector.reset(null);
        checkedInCollector.removeListener(changeSetListener);
      }
      if (activeCollector != null)
      {
        activeCollector.setChangeSetChangeListener(null);
        activeCollector.reset(null);
      }
      boolean handled = false;
      if ((checkedInCollector != null) && (getChangeSetCapability().enableCheckedInChangeSetsFor(getConfiguration())))
      {
        checkedInCollector.addListener(changeSetListener);
        checkedInCollector.reset(getSyncInfoSet());
        handled = true;
      }
      if ((activeCollector != null) && (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration())))
      {
        activeCollector.setChangeSetChangeListener(changeSetListener);
        activeCollector.reset(getSyncInfoSet());
        handled = true;
      }
      if (!handled)
      {
        ISynchronizeModelProvider provider = getProviderRootedAt(getModelRoot());
        if (provider != null) {
          ((SynchronizeModelProvider)provider).getSyncInfoSet().addAll(getSyncInfoSet());
        }
      }
    }
    return new IDiffElement[0];
  }
  
  public ISynchronizeModelProviderDescriptor getDescriptor()
  {
    return descriptor;
  }
  
  public ViewerSorter getViewerSorter()
  {
    if (viewerSorter == null) {
      viewerSorter = new ChangeSetModelSorter(this, ChangeSetActionGroup.getSortCriteria(getConfiguration()));
    }
    return viewerSorter;
  }
  
  public void setViewerSorter(ViewerSorter viewerSorter)
  {
    this.viewerSorter = viewerSorter;
    firePropertyChange("org.eclipse.team.ui.P_VIEWER_SORTER", null, null);
  }
  
  protected SynchronizePageActionGroup createActionGroup()
  {
    return new ChangeSetActionGroup(this);
  }
  
  private ISynchronizeModelProvider createProviderRootedAt(ISynchronizeModelElement parent, SyncInfoTree set)
  {
    ISynchronizeModelProvider provider = createModelProvider(parent, getSubproviderId(), set);
    addProvider(provider);
    rootToProvider.put(parent, provider);
    return provider;
  }
  
  private ISynchronizeModelProvider getProviderRootedAt(ISynchronizeModelElement parent)
  {
    return (ISynchronizeModelProvider)rootToProvider.get(parent);
  }
  
  protected void removeProvider(ISynchronizeModelProvider provider)
  {
    rootToProvider.remove(provider.getModelRoot());
    super.removeProvider(provider);
  }
  
  public String getSubproviderId()
  {
    return subProvierId;
  }
  
  public ViewerSorter getEmbeddedSorter()
  {
    return embeddedSorter;
  }
  
  protected void recursiveClearModelObjects(ISynchronizeModelElement node)
  {
    super.recursiveClearModelObjects(node);
    if (node == getModelRoot())
    {
      rootToProvider.clear();
      
      embeddedSorter = null;
      createRootProvider();
    }
  }
  
  private void createRootProvider()
  {
    SyncInfoTree tree;
    SyncInfoTree tree;
    if ((activeCollector != null) && (getChangeSetCapability().enableActiveChangeSetsFor(getConfiguration()))) {
      tree = activeCollector.getRootSet();
    } else {
      tree = new SyncInfoTree();
    }
    ISynchronizeModelProvider provider = createProviderRootedAt(getModelRoot(), tree);
    embeddedSorter = provider.getViewerSorter();
    if ((provider instanceof AbstractSynchronizeModelProvider))
    {
      SynchronizePageActionGroup actionGroup = ((AbstractSynchronizeModelProvider)provider).getActionGroup();
      if (actionGroup != null)
      {
        getConfiguration().addActionContribution(actionGroup);
        provider.addPropertyChangeListener(new IPropertyChangeListener()
        {
          private final ISynchronizeModelProvider val$provider;
          
          public void propertyChange(PropertyChangeEvent event)
          {
            if (event.getProperty().equals("org.eclipse.team.ui.P_VIEWER_SORTER"))
            {
              embeddedSorter = val$provider.getViewerSorter();
              firePropertyChange("org.eclipse.team.ui.P_VIEWER_SORTER", null, null);
            }
          }
        });
      }
    }
  }
  
  protected ISynchronizeModelElement getModelElement(ChangeSet set)
  {
    IDiffElement[] children = getModelRoot().getChildren();
    for (int i = 0; i < children.length; i++)
    {
      IDiffElement element = children[i];
      if (((element instanceof ChangeSetDiffNode)) && (((ChangeSetDiffNode)element).getSet() == set)) {
        return (ISynchronizeModelElement)element;
      }
    }
    return null;
  }
  
  public ChangeSetCapability getChangeSetCapability()
  {
    ISynchronizeParticipant participant = getConfiguration().getParticipant();
    if ((participant instanceof IChangeSetProvider))
    {
      IChangeSetProvider provider = (IChangeSetProvider)participant;
      return provider.getChangeSetCapability();
    }
    return null;
  }
  
  public void dispose()
  {
    if (checkedInCollector != null)
    {
      checkedInCollector.removeListener(changeSetListener);
      checkedInCollector.dispose();
    }
    if (activeCollector != null)
    {
      activeCollector.setChangeSetChangeListener(null);
      activeCollector.dispose();
    }
    super.dispose();
  }
  
  public void waitUntilDone(IProgressMonitor monitor)
  {
    super.waitUntilDone(monitor);
    if (checkedInCollector != null)
    {
      checkedInCollector.waitUntilDone(monitor);
      
      super.waitUntilDone(monitor);
    }
  }
  
  void removeModelElementForSet(ChangeSet set)
  {
    ISynchronizeModelElement node = getModelElement(set);
    if (node != null)
    {
      ISynchronizeModelProvider provider = getProviderRootedAt(node);
      removeFromViewer(new ISynchronizeModelElement[] { node });
      removeProvider(provider);
    }
  }
  
  public void createChangeSetModelElement(ChangeSet set, SyncInfoTree tree)
  {
    ISynchronizeModelElement node = getModelElement(set);
    ISynchronizeModelProvider provider = null;
    if (node != null) {
      provider = getProviderRootedAt(node);
    }
    if (provider == null)
    {
      provider = createProvider(set, tree);
      provider.prepareInput(null);
    }
  }
  
  private ISynchronizeModelProvider createProvider(ChangeSet set, SyncInfoTree tree)
  {
    ChangeSetDiffNode node = new ChangeSetDiffNode(getModelRoot(), set);
    addToViewer(node);
    return createProviderRootedAt(node, tree);
  }
  
  public void refreshLabel(ChangeSet set)
  {
    ISynchronizeModelElement node = getModelElement(set);
    if (node != null) {
      getViewer().refresh(node);
    }
  }
}

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

import java.util.Comparator;
import java.util.Date;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
import org.eclipse.team.internal.core.subscribers.ChangeSet;
import org.eclipse.team.internal.core.subscribers.CheckedInChangeSet;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;

public class ChangeSetModelSorter
  extends ViewerSorter
{
  private int commentCriteria;
  private ChangeSetModelProvider provider;
  public static final int DATE = 1;
  public static final int COMMENT = 2;
  public static final int USER = 3;
  
  public ChangeSetModelSorter(ChangeSetModelProvider provider, int commentCriteria)
  {
    this.provider = provider;
    this.commentCriteria = commentCriteria;
  }
  
  protected int classComparison(Object element)
  {
    if ((element instanceof ChangeSetDiffNode))
    {
      ChangeSet set = ((ChangeSetDiffNode)element).getSet();
      if ((set instanceof ActiveChangeSet)) {
        return 0;
      }
      return 1;
    }
    return 2;
  }
  
  protected int compareClass(Object element1, Object element2)
  {
    return classComparison(element1) - classComparison(element2);
  }
  
  protected int compareNames(String s1, String s2)
  {
    return getComparator().compare(s1, s2);
  }
  
  private int compareDates(Date d1, Date d2)
  {
    if (d1 == null) {
      d1 = new Date(0L);
    }
    if (d2 == null) {
      d2 = new Date(0L);
    }
    return d1.compareTo(d2);
  }
  
  public int compare(Viewer viewer, Object o1, Object o2)
  {
    if (((o1 instanceof ChangeSetDiffNode)) && ((o2 instanceof ChangeSetDiffNode)))
    {
      ChangeSet s1 = ((ChangeSetDiffNode)o1).getSet();
      ChangeSet s2 = ((ChangeSetDiffNode)o2).getSet();
      if (((s1 instanceof ActiveChangeSet)) && ((s2 instanceof ActiveChangeSet))) {
        return compareNames(((ActiveChangeSet)s1).getTitle(), ((ActiveChangeSet)s2).getTitle());
      }
      if (((s1 instanceof CheckedInChangeSet)) && ((s2 instanceof CheckedInChangeSet)))
      {
        CheckedInChangeSet r1 = (CheckedInChangeSet)s1;
        CheckedInChangeSet r2 = (CheckedInChangeSet)s2;
        if (commentCriteria == 1) {
          return compareDates(r1.getDate(), r2.getDate());
        }
        if (commentCriteria == 2) {
          return compareNames(r1.getComment(), r2.getComment());
        }
        if (commentCriteria == 3) {
          return compareNames(r1.getAuthor(), r2.getAuthor());
        }
        return 0;
      }
      if ((s1 instanceof ActiveChangeSet)) {
        return -1;
      }
      if ((s2 instanceof ActiveChangeSet)) {
        return 1;
      }
      if ((s1 instanceof CheckedInChangeSet)) {
        return -1;
      }
      if ((s2 instanceof CheckedInChangeSet)) {
        return 1;
      }
    }
    if (((o1 instanceof ISynchronizeModelElement)) && ((o2 instanceof ISynchronizeModelElement)))
    {
      ViewerSorter embeddedSorter = provider.getEmbeddedSorter();
      if (embeddedSorter != null) {
        return embeddedSorter.compare(viewer, o1, o2);
      }
      return compareNames(((ISynchronizeModelElement)o1).getName(), ((ISynchronizeModelElement)o2).getName());
    }
    if ((o1 instanceof ISynchronizeModelElement)) {
      return 1;
    }
    if ((o2 instanceof ISynchronizeModelElement)) {
      return -1;
    }
    return 0;
  }
  
  public int getCommentCriteria()
  {
    return commentCriteria;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.ChangeSetModelSorter
 * 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.Viewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.part.PageBook;

class ChangesSection$1
  implements Runnable
{
  final ChangesSection this$0;
  
  ChangesSection$1(ChangesSection paramChangesSection)
  {
    this$0 = paramChangesSection;
  }
  
  public void run()
  {
    Control control = this$0.getChangesViewer().getControl();
    if ((!this$0.getContainer().isDisposed()) && (!control.isDisposed())) {
      this$0.getContainer().showPage(control);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.ChangesSection.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.Viewer;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.part.PageBook;

public class ChangesSection
  extends Composite
{
  private AbstractSynchronizePage page;
  private ISynchronizePageConfiguration configuration;
  private FormToolkit forms;
  private PageBook changesSectionContainer;
  private Viewer changesViewer;
  
  public ChangesSection(Composite parent, AbstractSynchronizePage page, ISynchronizePageConfiguration configuration)
  {
    super(parent, 0);
    this.page = page;
    this.configuration = configuration;
    
    GridLayout layout = new GridLayout();
    marginHeight = 0;
    marginWidth = 0;
    setLayout(layout);
    GridData data = new GridData(1808);
    grabExcessVerticalSpace = true;
    setLayoutData(data);
    
    forms = new FormToolkit(parent.getDisplay());
    forms.setBackground(getListBackgroundColor());
    HyperlinkGroup group = forms.getHyperlinkGroup();
    group.setBackground(getListBackgroundColor());
    
    changesSectionContainer = new PageBook(this, 0);
    data = new GridData(1808);
    grabExcessHorizontalSpace = true;
    grabExcessVerticalSpace = true;
    changesSectionContainer.setLayoutData(data);
  }
  
  protected Color getListBackgroundColor()
  {
    return getShell().getDisplay().getSystemColor(25);
  }
  
  public PageBook getContainer()
  {
    return changesSectionContainer;
  }
  
  protected ISynchronizePageConfiguration getConfiguration()
  {
    return configuration;
  }
  
  protected FormToolkit getForms()
  {
    return forms;
  }
  
  protected AbstractSynchronizePage getPage()
  {
    return page;
  }
  
  public void dispose()
  {
    super.dispose();
    forms.dispose();
  }
  
  public void setViewer(Viewer viewer)
  {
    changesViewer = viewer;
    initializeChangesViewer();
  }
  
  protected void initializeChangesViewer()
  {
    TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable()
    {
      public void run()
      {
        Control control = getChangesViewer().getControl();
        if ((!getContainer().isDisposed()) && (!control.isDisposed())) {
          getContainer().showPage(control);
        }
      }
    });
  }
  
  public Viewer getChangesViewer()
  {
    return changesViewer;
  }
  
  protected boolean isThreeWay()
  {
    return "three-way".equals(getConfiguration().getComparisonType());
  }
}

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

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;

public abstract class CompositeModelProvider
  extends AbstractSynchronizeModelProvider
{
  private final List providers = new ArrayList();
  private final Map resourceToElements = new HashMap();
  private final Map elementToProvider = new HashMap();
  
  protected CompositeModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set)
  {
    super(configuration, set);
  }
  
  protected void addProvider(ISynchronizeModelProvider provider)
  {
    providers.add(provider);
  }
  
  protected void removeProvider(ISynchronizeModelProvider provider)
  {
    providers.remove(provider);
    provider.dispose();
  }
  
  protected ISynchronizeModelProvider getProvider(ISynchronizeModelElement element)
  {
    return (ISynchronizeModelProvider)elementToProvider.get(element);
  }
  
  public ISynchronizeModelElement[] getClosestExistingParents(IResource resource)
  {
    ISynchronizeModelProvider[] providers = getProviders();
    if (providers.length == 0) {
      return new ISynchronizeModelElement[0];
    }
    if ((providers.length == 1) && ((providers[0] instanceof AbstractSynchronizeModelProvider))) {
      return ((AbstractSynchronizeModelProvider)providers[0]).getClosestExistingParents(resource);
    }
    List result = new ArrayList();
    for (int i = 0; i < providers.length; i++)
    {
      ISynchronizeModelProvider provider = providers[i];
      if ((provider instanceof AbstractSynchronizeModelProvider))
      {
        ISynchronizeModelElement[] elements = ((AbstractSynchronizeModelProvider)provider).getClosestExistingParents(resource);
        for (int j = 0; j < elements.length; j++)
        {
          ISynchronizeModelElement element = elements[j];
          result.add(element);
        }
      }
    }
    return (ISynchronizeModelElement[])result.toArray(new ISynchronizeModelElement[result.size()]);
  }
  
  protected ISynchronizeModelProvider[] getProviders()
  {
    return (ISynchronizeModelProvider[])providers.toArray(new ISynchronizeModelProvider[providers.size()]);
  }
  
  protected ISynchronizeModelProvider[] getProvidersContaining(IResource resource)
  {
    List elements = (List)resourceToElements.get(resource);
    if ((elements == null) || (elements.isEmpty())) {
      return new ISynchronizeModelProvider[0];
    }
    List result = new ArrayList();
    for (Iterator iter = elements.iterator(); iter.hasNext();)
    {
      ISynchronizeModelElement element = (ISynchronizeModelElement)iter.next();
      result.add(getProvider(element));
    }
    return (ISynchronizeModelProvider[])result.toArray(new ISynchronizeModelProvider[result.size()]);
  }
  
  protected final void handleResourceAdditions(ISyncInfoTreeChangeEvent event)
  {
    handleAdditions(event.getAddedResources());
  }
  
  protected void handleAdditions(SyncInfo[] resources)
  {
    for (int i = 0; i < resources.length; i++)
    {
      SyncInfo info = resources[i];
      handleAddition(info);
    }
  }
  
  protected abstract void handleAddition(SyncInfo paramSyncInfo);
  
  protected final void handleResourceChanges(ISyncInfoTreeChangeEvent event)
  {
    SyncInfo[] infos = event.getChangedResources();
    for (int i = 0; i < infos.length; i++)
    {
      SyncInfo info = infos[i];
      handleChange(info);
    }
  }
  
  protected void handleChange(SyncInfo info)
  {
    handleRemoval(info.getLocal());
    handleAddition(info);
  }
  
  protected final void handleResourceRemovals(ISyncInfoTreeChangeEvent event)
  {
    IResource[] resources = event.getRemovedResources();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      handleRemoval(resource);
    }
  }
  
  protected void handleRemoval(IResource resource)
  {
    ISynchronizeModelProvider[] providers = getProvidersContaining(resource);
    for (int i = 0; i < providers.length; i++)
    {
      ISynchronizeModelProvider provider = providers[i];
      removeFromProvider(resource, provider);
    }
  }
  
  protected void removeFromProvider(IResource resource, ISynchronizeModelProvider provider)
  {
    if (provider != this) {
      provider.getSyncInfoSet().remove(resource);
    }
  }
  
  protected void nodeAdded(ISynchronizeModelElement node, AbstractSynchronizeModelProvider provider)
  {
    IResource r = node.getResource();
    if (r != null)
    {
      List elements = (List)resourceToElements.get(r);
      if (elements == null)
      {
        elements = new ArrayList(2);
        resourceToElements.put(r, elements);
      }
      elements.add(node);
    }
    elementToProvider.put(node, provider);
    super.nodeAdded(node, provider);
  }
  
  public void modelObjectCleared(ISynchronizeModelElement node)
  {
    super.modelObjectCleared(node);
    IResource r = node.getResource();
    if (r != null)
    {
      List elements = (List)resourceToElements.get(r);
      if (elements != null)
      {
        elements.remove(node);
        if (elements.isEmpty()) {
          resourceToElements.remove(r);
        }
      }
    }
    elementToProvider.remove(node);
  }
  
  protected void recursiveClearModelObjects(ISynchronizeModelElement node)
  {
    super.recursiveClearModelObjects(node);
    if (node == getModelRoot()) {
      clearProviders();
    }
  }
  
  private void clearProviders()
  {
    for (Iterator iter = providers.iterator(); iter.hasNext();)
    {
      ISynchronizeModelProvider provider = (ISynchronizeModelProvider)iter.next();
      provider.dispose();
    }
    providers.clear();
    resourceToElements.clear();
    elementToProvider.clear();
  }
  
  protected ISynchronizeModelProvider createModelProvider(ISynchronizeModelElement parent, String id, SyncInfoTree syncInfoTree)
  {
    if ((id != null) && (id.endsWith("org.eclipse.team.ui.modelprovider_flat"))) {
      return new FlatModelProvider(this, parent, getConfiguration(), syncInfoTree);
    }
    if ((id != null) && (id.endsWith("org.eclipse.team.ui.modelprovider_compressedfolders"))) {
      return new CompressedFoldersModelProvider(this, parent, getConfiguration(), syncInfoTree);
    }
    return new HierarchicalModelProvider(this, parent, getConfiguration(), syncInfoTree);
  }
  
  public void dispose()
  {
    clearProviders();
    super.dispose();
  }
  
  protected boolean hasViewerState()
  {
    return (resourceToElements != null) && (!resourceToElements.isEmpty());
  }
  
  protected ISynchronizeModelElement[] getModelObjects(IResource resource)
  {
    List elements = (List)resourceToElements.get(resource);
    if (elements == null) {
      return new ISynchronizeModelElement[0];
    }
    return (ISynchronizeModelElement[])elements.toArray(new ISynchronizeModelElement[elements.size()]);
  }
}

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

import java.text.Collator;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;

class CompressedFoldersModelProvider$1
  extends SynchronizeModelElementSorter
{
  final CompressedFoldersModelProvider this$0;
  
  CompressedFoldersModelProvider$1(CompressedFoldersModelProvider paramCompressedFoldersModelProvider)
  {
    this$0 = paramCompressedFoldersModelProvider;
  }
  
  protected int compareNames(IResource resource1, IResource resource2)
  {
    if ((resource1.getType() == 2) && (resource2.getType() == 2)) {
      return collator.compare(resource1.getProjectRelativePath().toString(), resource2.getProjectRelativePath().toString());
    }
    return super.compareNames(resource1, resource2);
  }
}

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

import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.TeamUIPlugin;

public class CompressedFoldersModelProvider$CompressedFolderDiffNode
  extends SyncInfoModelElement
{
  final CompressedFoldersModelProvider this$0;
  
  public CompressedFoldersModelProvider$CompressedFolderDiffNode(CompressedFoldersModelProvider paramCompressedFoldersModelProvider, IDiffContainer parent, SyncInfo info)
  {
    super(parent, info);
    this$0 = paramCompressedFoldersModelProvider;
  }
  
  public String getName()
  {
    IResource resource = getResource();
    return resource.getProjectRelativePath().toString();
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return TeamUIPlugin.getImageDescriptor("obj/compressed_folder_obj.gif");
  }
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;

public class CompressedFoldersModelProvider$CompressedFolderModelProviderDescriptor
  implements ISynchronizeModelProviderDescriptor
{
  public static final String ID = "org.eclipse.team.ui.modelprovider_compressedfolders";
  
  public String getId()
  {
    return "org.eclipse.team.ui.modelprovider_compressedfolders";
  }
  
  public String getName()
  {
    return TeamUIMessages.CompressedFoldersModelProvider_0;
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return TeamUIPlugin.getImageDescriptor("obj/compressed_folder_obj.gif");
  }
}

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

import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ui.TeamUIPlugin;

public class CompressedFoldersModelProvider$UnchangedCompressedDiffNode
  extends UnchangedResourceModelElement
{
  final CompressedFoldersModelProvider this$0;
  
  public CompressedFoldersModelProvider$UnchangedCompressedDiffNode(CompressedFoldersModelProvider paramCompressedFoldersModelProvider, IDiffContainer parent, IResource resource)
  {
    super(parent, resource);
    this$0 = paramCompressedFoldersModelProvider;
  }
  
  public String getName()
  {
    IResource resource = getResource();
    return resource.getProjectRelativePath().toString();
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    return TeamUIPlugin.getImageDescriptor("obj/compressed_folder_obj.gif");
  }
}

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

import java.text.Collator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.team.core.synchronize.ISyncInfoTreeChangeEvent;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.core.synchronize.SyncInfoTree;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;

public class CompressedFoldersModelProvider
  extends HierarchicalModelProvider
{
  protected class UnchangedCompressedDiffNode
    extends UnchangedResourceModelElement
  {
    public UnchangedCompressedDiffNode(IDiffContainer parent, IResource resource)
    {
      super(resource);
    }
    
    public String getName()
    {
      IResource resource = getResource();
      return resource.getProjectRelativePath().toString();
    }
    
    public ImageDescriptor getImageDescriptor(Object object)
    {
      return TeamUIPlugin.getImageDescriptor("obj/compressed_folder_obj.gif");
    }
  }
  
  public class CompressedFolderDiffNode
    extends SyncInfoModelElement
  {
    public CompressedFolderDiffNode(IDiffContainer parent, SyncInfo info)
    {
      super(info);
    }
    
    public String getName()
    {
      IResource resource = getResource();
      return resource.getProjectRelativePath().toString();
    }
    
    public ImageDescriptor getImageDescriptor(Object object)
    {
      return TeamUIPlugin.getImageDescriptor("obj/compressed_folder_obj.gif");
    }
  }
  
  public static class CompressedFolderModelProviderDescriptor
    implements ISynchronizeModelProviderDescriptor
  {
    public static final String ID = "org.eclipse.team.ui.modelprovider_compressedfolders";
    
    public String getId()
    {
      return "org.eclipse.team.ui.modelprovider_compressedfolders";
    }
    
    public String getName()
    {
      return TeamUIMessages.CompressedFoldersModelProvider_0;
    }
    
    public ImageDescriptor getImageDescriptor()
    {
      return TeamUIPlugin.getImageDescriptor("obj/compressed_folder_obj.gif");
    }
  }
  
  private static final CompressedFolderModelProviderDescriptor compressedDescriptor = new CompressedFolderModelProviderDescriptor();
  
  public CompressedFoldersModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set)
  {
    super(configuration, set);
  }
  
  public CompressedFoldersModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement modelRoot, ISynchronizePageConfiguration configuration, SyncInfoSet set)
  {
    super(parentProvider, modelRoot, configuration, set);
  }
  
  public ISynchronizeModelProviderDescriptor getDescriptor()
  {
    return compressedDescriptor;
  }
  
  public ViewerSorter getViewerSorter()
  {
    new SynchronizeModelElementSorter()
    {
      protected int compareNames(IResource resource1, IResource resource2)
      {
        if ((resource1.getType() == 2) && (resource2.getType() == 2)) {
          return collator.compare(resource1.getProjectRelativePath().toString(), resource2.getProjectRelativePath().toString());
        }
        return super.compareNames(resource1, resource2);
      }
    };
  }
  
  protected IDiffElement[] createModelObjects(ISynchronizeModelElement container)
  {
    IResource resource = null;
    if (container == getModelRoot()) {
      resource = ResourcesPlugin.getWorkspace().getRoot();
    } else {
      resource = container.getResource();
    }
    if (resource != null)
    {
      if (resource.getType() == 4) {
        return getProjectChildren(container, (IProject)resource);
      }
      if (resource.getType() == 2) {
        return getFolderChildren(container, resource);
      }
    }
    return super.createModelObjects(container);
  }
  
  private IDiffElement[] getFolderChildren(ISynchronizeModelElement parent, IResource resource)
  {
    IResource[] children = getSyncInfoTree().members(resource);
    List result = new ArrayList();
    for (int i = 0; i < children.length; i++)
    {
      IResource child = children[i];
      if (child.getType() == 1) {
        result.add(createModelObject(parent, child));
      }
    }
    return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
  }
  
  private IDiffElement[] getProjectChildren(ISynchronizeModelElement parent, IProject project)
  {
    SyncInfo[] outOfSync = getSyncInfoTree().getSyncInfos(project, 2);
    Set result = new HashSet();
    Set resourcesToShow = new HashSet();
    for (int i = 0; i < outOfSync.length; i++)
    {
      SyncInfo info = outOfSync[i];
      IResource local = info.getLocal();
      if ((local.getProjectRelativePath().segmentCount() == 1) && (local.getType() == 1)) {
        resourcesToShow.add(local);
      } else if (local.getType() == 1) {
        resourcesToShow.add(local.getParent());
      } else if (local.getType() == 2) {
        resourcesToShow.add(local);
      }
    }
    for (Iterator iter = resourcesToShow.iterator(); iter.hasNext();)
    {
      IResource resource = (IResource)iter.next();
      result.add(createModelObject(parent, resource));
    }
    return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
  }
  
  protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, IResource resource)
  {
    if (resource.getType() == 2)
    {
      SyncInfo info = getSyncInfoTree().getSyncInfo(resource);
      ISynchronizeModelElement newNode;
      ISynchronizeModelElement newNode;
      if (info != null) {
        newNode = new CompressedFolderDiffNode(parent, info);
      } else {
        newNode = new UnchangedCompressedDiffNode(parent, resource);
      }
      addToViewer(newNode);
      return newNode;
    }
    return super.createModelObject(parent, resource);
  }
  
  protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event)
  {
    SyncInfo[] infos = event.getAddedResources();
    for (int i = 0; i < infos.length; i++)
    {
      SyncInfo info = infos[i];
      addResource(info);
    }
  }
  
  protected void addResource(SyncInfo info)
  {
    IResource local = info.getLocal();
    ISynchronizeModelElement existingNode = getModelObject(local);
    if (existingNode == null)
    {
      if (local.getType() == 1)
      {
        ISynchronizeModelElement parentNode = getModelObject(local.getParent());
        if (parentNode == null)
        {
          ISynchronizeModelElement projectNode = getModelObject(local.getProject());
          if (projectNode == null) {
            projectNode = createModelObject(getModelRoot(), local.getProject());
          }
          if (local.getParent().getType() == 4) {
            parentNode = projectNode;
          } else {
            parentNode = createModelObject(projectNode, local.getParent());
          }
        }
        createModelObject(parentNode, local);
      }
      else
      {
        ISynchronizeModelElement projectNode = getModelObject(local.getProject());
        if (projectNode == null) {
          projectNode = createModelObject(getModelRoot(), local.getProject());
        }
        if (local.getProject() != local) {
          createModelObject(projectNode, local);
        }
      }
    }
    else {
      handleChange(existingNode, info);
    }
  }
  
  protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event)
  {
    IResource[] roots = event.getRemovedSubtreeRoots();
    
    List removedProjects = new ArrayList();
    for (int i = 0; i < roots.length; i++)
    {
      IResource resource = roots[i];
      if (resource.getType() == 4)
      {
        removeFromViewer(resource);
        removedProjects.add(resource);
      }
    }
    IResource[] resources = event.getRemovedResources();
    List resourcesToRemove = new ArrayList();
    List resourcesToAdd = new ArrayList();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      if (!removedProjects.contains(resource.getProject())) {
        if (resource.getType() == 1)
        {
          if ((isCompressedParentEmpty(resource)) && (!isOutOfSync(resource.getParent()))) {
            resourcesToRemove.add(resource.getParent());
          } else {
            r
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