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

    }
      return 0;
    }
    if ((o1 instanceof ISynchronizeModelElement)) {
      return 1;
    }
    if ((o2 instanceof ISynchronizeModelElement)) {
      return -1;
    }
    return 0;
  }
  
  public int getResourceCriteria()
  {
    return resourceCriteria;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.FlatModelProvider.FlatSorter
 * 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.team.core.synchronize.SyncInfo;

public class FlatModelProvider$FullPathSyncInfoElement
  extends SyncInfoModelElement
{
  public FlatModelProvider$FullPathSyncInfoElement(IDiffContainer parent, SyncInfo info)
  {
    super(parent, info);
  }
  
  public String getName()
  {
    IResource resource = getResource();
    return resource.getName() + " - " + resource.getFullPath().toString();
  }
}

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

import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;

class FlatModelProvider$ToggleSortOrderAction
  extends Action
{
  private int criteria;
  final FlatModelProvider this$0;
  
  protected FlatModelProvider$ToggleSortOrderAction(FlatModelProvider paramFlatModelProvider, String name, int criteria)
  {
    super(name, 8);this$0 = paramFlatModelProvider;
    this.criteria = criteria;
    update();
  }
  
  public void run()
  {
    if ((isChecked()) && (FlatModelProvider.access$0(this$0) != criteria))
    {
      FlatModelProvider.access$1(this$0, criteria);
      String key = getSettingsKey();
      IDialogSettings pageSettings = this$0.getConfiguration().getSite().getPageSettings();
      if (pageSettings != null) {
        pageSettings.put(key, criteria);
      }
      update();
      this$0.firePropertyChange("org.eclipse.team.ui.P_VIEWER_SORTER", null, null);
    }
  }
  
  public void update()
  {
    setChecked(FlatModelProvider.access$0(this$0) == criteria);
  }
  
  protected String getSettingsKey()
  {
    return "org.eclipse.team.ui.P_LAST_RESOURCE_SORT";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.FlatModelProvider.ToggleSortOrderAction
 * 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.List;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.Viewer;
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.internal.ui.TeamUIMessages;
import org.eclipse.team.ui.TeamImages;
import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.SynchronizePageActionGroup;

public class FlatModelProvider
  extends SynchronizeModelProvider
{
  public static class FlatModelProviderDescriptor
    implements ISynchronizeModelProviderDescriptor
  {
    public static final String ID = "org.eclipse.team.ui.modelprovider_flat";
    
    public String getId()
    {
      return "org.eclipse.team.ui.modelprovider_flat";
    }
    
    public String getName()
    {
      return TeamUIMessages.FlatModelProvider_0;
    }
    
    public ImageDescriptor getImageDescriptor()
    {
      return TeamImages.getImageDescriptor("elcl16/flatLayout.gif");
    }
  }
  
  private static final FlatModelProviderDescriptor flatDescriptor = new FlatModelProviderDescriptor();
  private static final String P_LAST_RESOURCESORT = "org.eclipse.team.ui.P_LAST_RESOURCE_SORT";
  private int sortCriteria = 2;
  
  public static class FullPathSyncInfoElement
    extends SyncInfoModelElement
  {
    public FullPathSyncInfoElement(IDiffContainer parent, SyncInfo info)
    {
      super(info);
    }
    
    public String getName()
    {
      IResource resource = getResource();
      return resource.getName() + " - " + resource.getFullPath().toString();
    }
  }
  
  public class FlatSorter
    extends ViewerSorter
  {
    private int resourceCriteria;
    public static final int NAME = 1;
    public static final int PATH = 2;
    public static final int PARENT_NAME = 3;
    
    public FlatSorter(int resourceCriteria)
    {
      this.resourceCriteria = resourceCriteria;
    }
    
    protected int classComparison(Object element)
    {
      if ((element instanceof FlatModelProvider.FullPathSyncInfoElement)) {
        return 0;
      }
      return 1;
    }
    
    protected int compareClass(Object element1, Object element2)
    {
      return classComparison(element1) - classComparison(element2);
    }
    
    protected int compareNames(String s1, String s2)
    {
      return collator.compare(s1, s2);
    }
    
    public int compare(Viewer viewer, Object o1, Object o2)
    {
      if (((o1 instanceof FlatModelProvider.FullPathSyncInfoElement)) && ((o2 instanceof FlatModelProvider.FullPathSyncInfoElement)))
      {
        IResource r1 = ((FlatModelProvider.FullPathSyncInfoElement)o1).getResource();
        IResource r2 = ((FlatModelProvider.FullPathSyncInfoElement)o2).getResource();
        if (resourceCriteria == 1) {
          return compareNames(r1.getName(), r2.getName());
        }
        if (resourceCriteria == 2) {
          return compareNames(r1.getFullPath().toString(), r2.getFullPath().toString());
        }
        if (resourceCriteria == 3) {
          return compareNames(r1.getParent().getName(), r2.getParent().getName());
        }
        return 0;
      }
      if ((o1 instanceof ISynchronizeModelElement)) {
        return 1;
      }
      if ((o2 instanceof ISynchronizeModelElement)) {
        return -1;
      }
      return 0;
    }
    
    public int getResourceCriteria()
    {
      return resourceCriteria;
    }
  }
  
  private class ToggleSortOrderAction
    extends Action
  {
    private int criteria;
    
    protected ToggleSortOrderAction(String name, int criteria)
    {
      super(8);
      this.criteria = criteria;
      update();
    }
    
    public void run()
    {
      if ((isChecked()) && (sortCriteria != criteria))
      {
        sortCriteria = criteria;
        String key = getSettingsKey();
        IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
        if (pageSettings != null) {
          pageSettings.put(key, criteria);
        }
        update();
        firePropertyChange("org.eclipse.team.ui.P_VIEWER_SORTER", null, null);
      }
    }
    
    public void update()
    {
      setChecked(sortCriteria == criteria);
    }
    
    protected String getSettingsKey()
    {
      return "org.eclipse.team.ui.P_LAST_RESOURCE_SORT";
    }
  }
  
  public class FlatActionGroup
    extends SynchronizePageActionGroup
  {
    private MenuManager sortByResource;
    
    public FlatActionGroup() {}
    
    public void initialize(ISynchronizePageConfiguration configuration)
    {
      super.initialize(configuration);
      sortByResource = new MenuManager(TeamUIMessages.FlatModelProvider_6);
      
      appendToGroup(
        "org.eclipse.team.ui.P_CONTEXT_MENU", 
        "sort", 
        sortByResource);
      
      FlatModelProvider.this.initialize(configuration);
      
      sortByResource.add(new FlatModelProvider.ToggleSortOrderAction(FlatModelProvider.this, TeamUIMessages.FlatModelProvider_8, 2));
      sortByResource.add(new FlatModelProvider.ToggleSortOrderAction(FlatModelProvider.this, TeamUIMessages.FlatModelProvider_7, 1));
      sortByResource.add(new FlatModelProvider.ToggleSortOrderAction(FlatModelProvider.this, TeamUIMessages.FlatModelProvider_9, 3));
    }
    
    public void dispose()
    {
      sortByResource.dispose();
      sortByResource.removeAll();
      super.dispose();
    }
  }
  
  public FlatModelProvider(ISynchronizePageConfiguration configuration, SyncInfoSet set)
  {
    super(configuration, set);
    initialize(configuration);
  }
  
  public FlatModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement modelRoot, ISynchronizePageConfiguration configuration, SyncInfoSet set)
  {
    super(parentProvider, modelRoot, configuration, set);
    initialize(configuration);
  }
  
  private void initialize(ISynchronizePageConfiguration configuration)
  {
    try
    {
      IDialogSettings pageSettings = getConfiguration().getSite().getPageSettings();
      if (pageSettings != null) {
        sortCriteria = pageSettings.getInt("org.eclipse.team.ui.P_LAST_RESOURCE_SORT");
      }
    }
    catch (NumberFormatException localNumberFormatException) {}
    switch (sortCriteria)
    {
    case 1: 
    case 2: 
    case 3: 
      break;
    default: 
      sortCriteria = 2;
    }
  }
  
  protected SynchronizePageActionGroup createActionGroup()
  {
    return new FlatActionGroup();
  }
  
  public ViewerSorter getViewerSorter()
  {
    return new FlatSorter(sortCriteria);
  }
  
  protected IDiffElement[] buildModelObjects(ISynchronizeModelElement node)
  {
    if (node == getModelRoot()) {}
    SyncInfo[] infos = getSyncInfoSet().getSyncInfos();
    List result = new ArrayList();
    for (int i = 0; i < infos.length; i++)
    {
      SyncInfo info = infos[i];
      result.add(createModelObject(node, info));
    }
    return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
  }
  
  protected void handleResourceAdditions(ISyncInfoTreeChangeEvent event)
  {
    addResources(event.getAddedResources());
  }
  
  protected void handleResourceRemovals(ISyncInfoTreeChangeEvent event)
  {
    IResource[] resources = event.getRemovedResources();
    removeFromViewer(resources);
  }
  
  public ISynchronizeModelProviderDescriptor getDescriptor()
  {
    return flatDescriptor;
  }
  
  protected void addResource(SyncInfo info)
  {
    ISynchronizeModelElement node = getModelObject(info.getLocal());
    if (node != null) {
      removeFromViewer(info.getLocal());
    }
    createModelObject(getModelRoot(), info);
  }
  
  protected ISynchronizeModelElement createModelObject(ISynchronizeModelElement parent, SyncInfo info)
  {
    SynchronizeModelElement newNode = new FullPathSyncInfoElement(parent, info);
    addToViewer(newNode);
    return newNode;
  }
}

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

import org.eclipse.ui.part.PageBook;

class ForwardingChangesSection$1
  implements Runnable
{
  final ForwardingChangesSection this$0;
  
  ForwardingChangesSection$1(ForwardingChangesSection paramForwardingChangesSection)
  {
    this$0 = paramForwardingChangesSection;
  }
  
  public void run()
  {
    if (!this$0.getContainer().isDisposed()) {
      this$0.updatePage(this$0.getEmptyChangesComposite(this$0.getContainer()));
    }
  }
}

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

class ForwardingChangesSection$2
  implements Runnable
{
  final ForwardingChangesSection this$0;
  
  ForwardingChangesSection$2(ForwardingChangesSection paramForwardingChangesSection)
  {
    this$0 = paramForwardingChangesSection;
  }
  
  public void run()
  {
    this$0.updatePage(null);
  }
}

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

import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;

class ForwardingChangesSection$3
  extends HyperlinkAdapter
{
  final ForwardingChangesSection this$0;
  private final int val$candidateMode;
  
  ForwardingChangesSection$3(ForwardingChangesSection paramForwardingChangesSection, int paramInt)
  {
    this$0 = paramForwardingChangesSection;val$candidateMode = paramInt;
  }
  
  public void linkActivated(HyperlinkEvent e)
  {
    this$0.getConfiguration().setMode(val$candidateMode);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.ForwardingChangesSection.3
 * 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.osgi.util.NLS;
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.Label;
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.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.eclipse.ui.part.PageBook;

public abstract class ForwardingChangesSection
  extends ChangesSection
{
  private Composite messageArea;
  
  public ForwardingChangesSection(Composite parent, AbstractSynchronizePage page, ISynchronizePageConfiguration configuration)
  {
    super(parent, page, configuration);
  }
  
  protected void initializeChangesViewer()
  {
    calculateDescription();
  }
  
  protected void calculateDescription()
  {
    if (getContainer().isDisposed()) {
      return;
    }
    if (getVisibleChangesCount() == 0L) {
      TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          if (!getContainer().isDisposed()) {
            updatePage(getEmptyChangesComposite(getContainer()));
          }
        }
      });
    } else {
      TeamUIPlugin.getStandardDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          updatePage(null);
        }
      });
    }
  }
  
  protected void updatePage(Composite message)
  {
    if (getContainer().isDisposed()) {
      return;
    }
    if (messageArea != null)
    {
      messageArea.dispose();
      messageArea = null;
    }
    messageArea = message;
    if (message == null)
    {
      Control control = getChangesViewer().getControl();
      if ((!getContainer().isDisposed()) && (!control.isDisposed())) {
        getContainer().showPage(control);
      }
    }
    else
    {
      getContainer().showPage(messageArea);
    }
  }
  
  protected Composite getEmptyChangesComposite(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setBackground(getListBackgroundColor());
    GridLayout layout = new GridLayout();
    numColumns = 2;
    composite.setLayout(layout);
    GridData data = new GridData(1808);
    grabExcessVerticalSpace = true;
    composite.setLayoutData(data);
    if (!isThreeWay())
    {
      createDescriptionLabel(composite, NLS.bind(TeamUIMessages.ChangesSection_noChanges, new String[] { Utils.shortenText(100, getConfiguration().getParticipant().getName()) }));
      return composite;
    }
    int allChanges = getChangesCount();
    long visibleChanges = getVisibleChangesCount();
    if ((visibleChanges == 0L) && (allChanges != 0))
    {
      int candidateMode = getCandidateMode();
      int currentMode = getConfiguration().getMode();
      if (candidateMode != currentMode)
      {
        long numChanges = getChangesInMode(candidateMode);
        if (numChanges > 0L)
        {
          String message;
          if (numChanges > 1L) {
            message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesPlural, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
          } else {
            message = NLS.bind(TeamUIMessages.ChangesSection_filterHidesSingular, new String[] { Long.toString(numChanges), Utils.modeToString(candidateMode) });
          }
          String message = NLS.bind(TeamUIMessages.ChangesSection_filterHides, new String[] { Utils.modeToString(getConfiguration().getMode()), message });
          
          Label warning = new Label(composite, 0);
          warning.setImage(TeamUIPlugin.getPlugin().getImage("ovr/warning_co.gif"));
          
          Hyperlink link = getForms().createHyperlink(composite, NLS.bind(TeamUIMessages.ChangesSection_filterChange, new String[] { Utils.modeToString(candidateMode) }), 64);
          link.addHyperlinkListener(new HyperlinkAdapter()
          {
            private final int val$candidateMode;
            
            public void linkActivated(HyperlinkEvent e)
            {
              getConfiguration().setMode(val$candidateMode);
            }
          });
          getForms().getHyperlinkGroup().add(link);
          createDescriptionLabel(composite, message);
          return composite;
        }
      }
    }
    createDescriptionLabel(composite, NLS.bind(TeamUIMessages.ChangesSection_noChanges, new String[] { Utils.shortenText(100, getConfiguration().getParticipant().getName()) }));
    return composite;
  }
  
  protected Label createDescriptionLabel(Composite parent, String text)
  {
    Label description = new Label(parent, 64);
    GridData data = new GridData(768);
    horizontalSpan = 2;
    widthHint = 100;
    description.setLayoutData(data);
    description.setText(text);
    description.setBackground(getListBackgroundColor());
    return description;
  }
  
  protected abstract int getChangesCount();
  
  protected abstract long getChangesInMode(int paramInt);
  
  protected abstract long getVisibleChangesCount();
  
  protected abstract int getCandidateMode();
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class GlobalRefreshElementSelectionPage$1
  extends SelectionAdapter
{
  final GlobalRefreshElementSelectionPage this$0;
  
  GlobalRefreshElementSelectionPage$1(GlobalRefreshElementSelectionPage paramGlobalRefreshElementSelectionPage)
  {
    this$0 = paramGlobalRefreshElementSelectionPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    GlobalRefreshElementSelectionPage.access$0(this$0).setSelection(true);
    GlobalRefreshElementSelectionPage.access$1(this$0).setSelection(false);
    GlobalRefreshElementSelectionPage.access$2(this$0).setSelection(false);
    GlobalRefreshElementSelectionPage.access$3(this$0);
    GlobalRefreshElementSelectionPage.access$4(this$0, true);
    this$0.updateOKStatus();
    GlobalRefreshElementSelectionPage.access$4(this$0, false);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;

class GlobalRefreshElementSelectionPage$2
  extends SelectionAdapter
{
  final GlobalRefreshElementSelectionPage this$0;
  
  GlobalRefreshElementSelectionPage$2(GlobalRefreshElementSelectionPage paramGlobalRefreshElementSelectionPage)
  {
    this$0 = paramGlobalRefreshElementSelectionPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    GlobalRefreshElementSelectionPage.access$5(this$0).setCheckedElements(new Object[0]);
    this$0.updateOKStatus();
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GlobalRefreshElementSelectionPage$3
  extends SelectionAdapter
{
  final GlobalRefreshElementSelectionPage this$0;
  
  GlobalRefreshElementSelectionPage$3(GlobalRefreshElementSelectionPage paramGlobalRefreshElementSelectionPage)
  {
    this$0 = paramGlobalRefreshElementSelectionPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    GlobalRefreshElementSelectionPage.access$3(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.GlobalRefreshElementSelectionPage.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.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GlobalRefreshElementSelectionPage$4
  extends SelectionAdapter
{
  final GlobalRefreshElementSelectionPage this$0;
  
  GlobalRefreshElementSelectionPage$4(GlobalRefreshElementSelectionPage paramGlobalRefreshElementSelectionPage)
  {
    this$0 = paramGlobalRefreshElementSelectionPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    GlobalRefreshElementSelectionPage.access$6(this$0);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GlobalRefreshElementSelectionPage$5
  extends SelectionAdapter
{
  final GlobalRefreshElementSelectionPage this$0;
  
  GlobalRefreshElementSelectionPage$5(GlobalRefreshElementSelectionPage paramGlobalRefreshElementSelectionPage)
  {
    this$0 = paramGlobalRefreshElementSelectionPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    if (this$0.isWorkingSetSelected()) {
      GlobalRefreshElementSelectionPage.access$7(this$0);
    }
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class GlobalRefreshElementSelectionPage$6
  extends SelectionAdapter
{
  final GlobalRefreshElementSelectionPage this$0;
  
  GlobalRefreshElementSelectionPage$6(GlobalRefreshElementSelectionPage paramGlobalRefreshElementSelectionPage)
  {
    this$0 = paramGlobalRefreshElementSelectionPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    GlobalRefreshElementSelectionPage.access$8(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.GlobalRefreshElementSelectionPage.6
 * 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.List;
import java.util.StringTokenizer;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
import org.eclipse.ui.help.IWorkbenchHelpSystem;

public abstract class GlobalRefreshElementSelectionPage
  extends WizardPage
{
  private boolean scopeCheckingElement = false;
  private Button participantScope;
  private Button selectedResourcesScope;
  private Button workingSetScope;
  private ContainerCheckedTreeViewer fViewer;
  private Text workingSetLabel;
  private IWorkingSet[] workingSets;
  private IDialogSettings settings;
  private static final String STORE_SECTION = "SynchronizeResourceSelectionDialog";
  private static final String STORE_WORKING_SETS = "SynchronizeResourceSelectionDialog.STORE_WORKING_SETS";
  
  protected GlobalRefreshElementSelectionPage(String pageName)
  {
    super(pageName);
    IDialogSettings s = TeamUIPlugin.getPlugin().getDialogSettings();
    settings = s.getSection("SynchronizeResourceSelectionDialog");
    if (settings == null) {
      settings = s.addNewSection("SynchronizeResourceSelectionDialog");
    }
  }
  
  public void createControl(Composite parent2)
  {
    Composite top = new Composite(parent2, 0);
    top.setLayout(new GridLayout());
    initializeDialogUnits(top);
    
    GridData data = new GridData(1808);
    widthHint = 50;
    top.setLayoutData(data);
    setControl(top);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), "org.eclipse.team.ui.sync_resource_selection_page_context");
    
    Label l = new Label(top, 0);
    l.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_5);
    
    fViewer = createViewer(top);
    
    Composite selectGroup = new Composite(top, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginHeight = 0;
    marginWidth = 0;
    
    selectGroup.setLayout(layout);
    data = new GridData(768);
    selectGroup.setLayoutData(data);
    
    Button selectAll = new Button(selectGroup, 0);
    selectAll.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_12);
    selectAll.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        participantScope.setSelection(true);
        selectedResourcesScope.setSelection(false);
        workingSetScope.setSelection(false);
        GlobalRefreshElementSelectionPage.this.updateParticipantScope();
        scopeCheckingElement = true;
        updateOKStatus();
        scopeCheckingElement = false;
      }
    });
    setButtonLayoutData(selectAll);
    
    Button deSelectAll = new Button(selectGroup, 0);
    deSelectAll.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_13);
    deSelectAll.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        fViewer.setCheckedElements(new Object[0]);
        updateOKStatus();
      }
    });
    setButtonLayoutData(deSelectAll);
    
    Group scopeGroup = new Group(top, 0);
    scopeGroup.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_6);
    layout = new GridLayout();
    numColumns = 3;
    makeColumnsEqualWidth = false;
    scopeGroup.setLayout(layout);
    data = new GridData(768);
    widthHint = 50;
    scopeGroup.setLayoutData(data);
    
    participantScope = new Button(scopeGroup, 16);
    participantScope.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_7);
    participantScope.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        GlobalRefreshElementSelectionPage.this.updateParticipantScope();
      }
    });
    selectedResourcesScope = new Button(scopeGroup, 16);
    selectedResourcesScope.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_8);
    selectedResourcesScope.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        GlobalRefreshElementSelectionPage.this.updateSelectedResourcesScope();
      }
    });
    data = new GridData();
    horizontalSpan = 2;
    selectedResourcesScope.setLayoutData(data);
    
    workingSetScope = new Button(scopeGroup, 16);
    workingSetScope.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_10);
    workingSetScope.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        if (isWorkingSetSelected()) {
          GlobalRefreshElementSelectionPage.this.updateWorkingSetScope();
        }
      }
    });
    workingSetLabel = new Text(scopeGroup, 2048);
    workingSetLabel.setEditable(false);
    data = new GridData(768);
    workingSetLabel.setLayoutData(data);
    
    Button selectWorkingSetButton = new Button(scopeGroup, 0);
    selectWorkingSetButton.setText(TeamUIMessages.GlobalRefreshResourceSelectionPage_11);
    selectWorkingSetButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        GlobalRefreshElementSelectionPage.this.selectWorkingSetAction();
      }
    });
    data = new GridData(128);
    selectWorkingSetButton.setLayoutData(data);
    Dialog.applyDialogFont(selectWorkingSetButton);
    
    initializeScopingHint();
    Dialog.applyDialogFont(top);
  }
  
  protected abstract ContainerCheckedTreeViewer createViewer(Composite paramComposite);
  
  protected void updateOKStatus()
  {
    if (fViewer != null)
    {
      if ((!scopeCheckingElement) && 
        (!selectedResourcesScope.getSelection()))
      {
        selectedResourcesScope.setSelection(true);
        participantScope.setSelection(false);
        workingSetScope.setSelection(false);
        updateSelectedResourcesScope();
      }
      setPageComplete(areAnyElementsChecked());
    }
    else
    {
      setPageComplete(false);
    }
  }
  
  private boolean areAnyElementsChecked()
  {
    TreeItem[] item = fViewer.getTree().getItems();
    for (int i = 0; i < item.length; i++)
    {
      TreeItem child = item[i];
      if ((child.getChecked()) || (child.getGrayed())) {
        return true;
      }
    }
    return false;
  }
  
  public Object[] getRootElement()
  {
    TreeItem[] item = fViewer.getTree().getItems();
    List checked = new ArrayList();
    for (int i = 0; i < item.length; i++)
    {
      TreeItem child = item[i];
      collectCheckedItems(child, checked);
    }
    return checked.toArray(new Object[checked.size()]);
  }
  
  protected void initializeScopingHint()
  {
    String working_sets = settings.get("SynchronizeResourceSelectionDialog.STORE_WORKING_SETS");
    if ((working_sets == null) || (working_sets.equals("")))
    {
      participantScope.setSelection(true);
      updateParticipantScope();
    }
    else
    {
      StringTokenizer st = new StringTokenizer(working_sets, " ,");
      ArrayList ws = new ArrayList();
      while (st.hasMoreTokens())
      {
        String workingSetName = st.nextToken();
        if ((workingSetName != null) && (!workingSetName.equals("")))
        {
          IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
          IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
          if (workingSet != null) {
            ws.add(workingSet);
          }
        }
      }
      if (!ws.isEmpty())
      {
        workingSets = ((IWorkingSet[])ws.toArray(new IWorkingSet[ws.size()]));
        updateWorkingSetScope();
        updateWorkingSetLabel();
        participantScope.setSelection(false);
        selectedResourcesScope.setSelection(false);
        workingSetScope.setSelection(true);
      }
    }
  }
  
  public void dispose()
  {
    if ((workingSets != null) && (isWorkingSetSelected()))
    {
      String concatsWorkingSets = makeWorkingSetLabel();
      settings.put("SynchronizeResourceSelectionDialog.STORE_WORKING_SETS", concatsWorkingSets);
    }
    else
    {
      settings.put("SynchronizeResourceSelectionDialog.STORE_WORKING_SETS", null);
    }
  }
  
  private void updateParticipantScope()
  {
    if (isWorkspaceSelected())
    {
      scopeCheckingElement = true;
      checkAll();
      setPageComplete(getRootElement().length > 0);
      scopeCheckingElement = false;
    }
  }
  
  protected abstract void checkAll();
  
  private void updateSelectedResourcesScope()
  {
    setPageComplete(getRootElement().length > 0);
  }
  
  private void selectWorkingSetAction()
  {
    IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
    IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), true);
    dialog.open();
    IWorkingSet[] sets = dialog.getSelection();
    if (sets != null) {
      workingSets = sets;
    } else {
      return;
    }
    updateWorkingSetScope();
    updateWorkingSetLabel();
    
    participantScope.setSelection(false);
    selectedResourcesScope.setSelection(false);
    workingSetScope.setSelection(true);
  }
  
  private void updateWorkingSetScope()
  {
    if (workingSets != null)
    {
      scopeCheckingElement = true;
      boolean hasElements = checkWorkingSetElements();
      scopeCheckingElement = false;
      setPageComplete(hasElements);
    }
    else
    {
      scopeCheckingElement = true;
      fViewer.setCheckedElements(new Object[0]);
      scopeCheckingElement = false;
      setPageComplete(false);
    }
  }
  
  protected abstract boolean checkWorkingSetElements();
  
  private void collectCheckedItems(TreeItem item, List checked)
  {
    if ((item.getChecked()) && (!item.getGrayed()))
    {
      checked.add(item.getData());
    }
    else if (item.getGrayed())
    {
      TreeItem[] children = item.getItems();
      for (int i = 0; i < children.length; i++)
      {
        TreeItem child = children[i];
        collectCheckedItems(child, checked);
      }
    }
  }
  
  private void updateWorkingSetLabel()
  {
    if ((workingSets == null) || (workingSets.length == 0)) {
      workingSetLabel.setText(TeamUIMessages.StatisticsPanel_noWorkingSet);
    } else {
      workingSetLabel.setText(makeWorkingSetLabel());
    }
  }
  
  private String makeWorkingSetLabel()
  {
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < workingSets.length; i++)
    {
      IWorkingSet set = workingSets[i];
      if (i != 0) {
        buffer.append(", ");
      }
      buffer.append(set.getLabel());
    }
    return buffer.toString();
  }
  
  protected boolean isWorkspaceSelected()
  {
    return participantScope.getSelection();
  }
  
  protected void setWorkspaceSelected(boolean selected)
  {
    workingSetScope.setSelection(!selected);
    selectedResourcesScope.setSelection(!selected);
    participantScope.setSelection(selected);
  }
  
  protected boolean isWorkingSetSelected()
  {
    return workingSetScope.getSelection();
  }
  
  public IWorkingSet[] getWorkingSets()
  {
    return workingSets;
  }
  
  public ContainerCheckedTreeViewer getViewer()
  {
    return fViewer;
  }
  
  protected boolean isSelectedResourcesSelected()
  {
    return selectedResourcesScope.getSelection();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.GlobalRefreshElementSelectionPage
 * 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.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;

class GlobalRefreshResourceSelectionPage$1
  implements ICheckStateListener
{
  final GlobalRefreshResourceSelectionPage this$0;
  
  GlobalRefreshResourceSelectionPage$1(GlobalRefreshResourceSelectionPage paramGlobalRefreshResourceSelectionPage)
  {
    this$0 = paramGlobalRefreshResourceSelectionPage;
  }
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    this$0.updateOKStatus();
  }
}

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

import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;

class GlobalRefreshResourceSelectionPage$MyContentProvider
  extends BaseWorkbenchContentProvider
{
  final GlobalRefreshResourceSelectionPage this$0;
  
  GlobalRefreshResourceSelectionPage$MyContentProvider(GlobalRefreshResourceSelectionPage paramGlobalRefreshResourceSelectionPage)
  {
    this$0 = paramGlobalRefreshResourceSelectionPage;
  }
  
  public Object[] getChildren(Object element)
  {
    if ((element instanceof List)) {
      return ((List)element).toArray(new IResource[((List)element).size()]);
    }
    return super.getChildren(element);
  }
}

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

import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.model.WorkbenchLabelProvider;

class GlobalRefreshResourceSelectionPage$MyLabelProvider
  extends LabelProvider
{
  private LabelProvider workbenchProvider;
  final GlobalRefreshResourceSelectionPage this$0;
  
  GlobalRefreshResourceSelectionPage$MyLabelProvider(GlobalRefreshResourceSelectionPage paramGlobalRefreshResourceSelectionPage)
  {
    this$0 = paramGlobalRefreshResourceSelectionPage;
    workbenchProvider = new WorkbenchLabelProvider();
  }
  
  public String getText(Object element)
  {
    if ((element instanceof IContainer))
    {
      IContainer c = (IContainer)element;
      if ((c.getType() != 4) && (GlobalRefreshResourceSelectionPage.access$0(this$0).contains(c))) {
        return c.getFullPath().toString();
      }
    }
    return workbenchProvider.getText(element);
  }
  
  public Image getImage(Object element)
  {
    return workbenchProvider.getImage(element);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ui.synchronize.GlobalRefreshResourceSelectionPage.MyLabelProvider
 * 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.Arrays;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.v
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