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

ource = sync.getLocal();
    node = new MyDiffNode(null, sync);
    setTitle(NLS.bind(TeamUIMessages.SyncInfoCompareInput_title, new String[] { sync.getLocal().getName() }));
  }
  
  public SyncInfoCompareInput(ISynchronizeParticipant participant, SyncInfo sync)
  {
    this(participant.getName(), sync);
    this.participant = participant;
  }
  
  public SyncInfoCompareInput(ISynchronizePageConfiguration configuration, SyncInfo info)
  {
    this(configuration.getParticipant(), info);
    synchronizeConfiguration = configuration;
  }
  
  protected void handleDispose()
  {
    super.handleDispose();
    if (synchronizeConfiguration != null)
    {
      ICompareNavigator navigator = (ICompareNavigator)synchronizeConfiguration.getProperty("org.eclipse.team.ui.P_INPUT_NAVIGATOR");
      if ((navigator != null) && (navigator == super.getNavigator())) {
        synchronizeConfiguration.setProperty("org.eclipse.team.ui.P_INPUT_NAVIGATOR", new CompareNavigator()
        {
          protected INavigatable[] getNavigatables()
          {
            return new INavigatable[0];
          }
        });
      }
    }
  }
  
  public Object getAdapter(Class adapter)
  {
    if ((IFile.class.equals(adapter)) && (resource.getType() == 1)) {
      return resource;
    }
    return super.getAdapter(adapter);
  }
  
  private static CompareConfiguration getDefaultCompareConfiguration()
  {
    CompareConfiguration cc = new CompareConfiguration();
    
    return cc;
  }
  
  public void resourceChanged(IResourceChangeEvent event)
  {
    IResourceDelta delta = event.getDelta();
    if (delta != null)
    {
      IResourceDelta resourceDelta = delta.findMember(resource.getFullPath());
      if (resourceDelta != null)
      {
        UIJob job = new UIJob("")
        {
          public IStatus runInUIThread(IProgressMonitor monitor)
          {
            isSaveNeeded();
            
            return Status.OK_STATUS;
          }
        };
        job.setSystem(true);
        job.schedule();
      }
    }
  }
  
  /* Error */
  protected org.eclipse.compare.structuremergeviewer.ICompareInput prepareCompareInput(IProgressMonitor monitor)
    throws java.lang.reflect.InvocationTargetException, java.lang.InterruptedException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_0
    //   2: invokevirtual 307	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:getTitle	()Ljava/lang/String;
    //   5: invokevirtual 308	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:setTitle	(Ljava/lang/String;)V
    //   8: aload_1
    //   9: getstatic 278	org/eclipse/team/internal/ui/TeamUIMessages:SyncInfoCompareInput_3	Ljava/lang/String;
    //   12: bipush 100
    //   14: invokeinterface 333 3 0
    //   19: aload_1
    //   20: getstatic 278	org/eclipse/team/internal/ui/TeamUIMessages:SyncInfoCompareInput_3	Ljava/lang/String;
    //   23: invokeinterface 332 2 0
    //   28: aload_0
    //   29: getfield 285	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:participant	Lorg/eclipse/team/ui/synchronize/ISynchronizeParticipant;
    //   32: ifnull +29 -> 61
    //   35: aload_0
    //   36: getfield 285	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:participant	Lorg/eclipse/team/ui/synchronize/ISynchronizeParticipant;
    //   39: aload_0
    //   40: getfield 286	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:node	Lorg/eclipse/team/ui/synchronize/SyncInfoCompareInput$MyDiffNode;
    //   43: aload_0
    //   44: invokevirtual 309	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:getCompareConfiguration	()Lorg/eclipse/compare/CompareConfiguration;
    //   47: aload_1
    //   48: bipush 100
    //   50: invokestatic 298	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   53: invokeinterface 342 4 0
    //   58: goto +53 -> 111
    //   61: aload_0
    //   62: getfield 286	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:node	Lorg/eclipse/team/ui/synchronize/SyncInfoCompareInput$MyDiffNode;
    //   65: invokevirtual 320	org/eclipse/team/ui/synchronize/SyncInfoCompareInput$MyDiffNode:getSyncInfo	()Lorg/eclipse/team/core/synchronize/SyncInfo;
    //   68: aload_0
    //   69: invokevirtual 309	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:getCompareConfiguration	()Lorg/eclipse/compare/CompareConfiguration;
    //   72: aload_1
    //   73: invokestatic 300	org/eclipse/team/internal/ui/Utils:updateLabels	(Lorg/eclipse/team/core/synchronize/SyncInfo;Lorg/eclipse/compare/CompareConfiguration;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   76: aload_0
    //   77: getfield 286	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:node	Lorg/eclipse/team/ui/synchronize/SyncInfoCompareInput$MyDiffNode;
    //   80: aload_1
    //   81: bipush 100
    //   83: invokestatic 298	org/eclipse/team/internal/ui/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   86: invokevirtual 319	org/eclipse/team/ui/synchronize/SyncInfoCompareInput$MyDiffNode:cacheContents	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   89: goto +22 -> 111
    //   92: astore_2
    //   93: new 133	java/lang/reflect/InvocationTargetException
    //   96: dup
    //   97: aload_2
    //   98: invokespecial 291	java/lang/reflect/InvocationTargetException:<init>	(Ljava/lang/Throwable;)V
    //   101: athrow
    //   102: astore_3
    //   103: aload_1
    //   104: invokeinterface 331 1 0
    //   109: aload_3
    //   110: athrow
    //   111: aload_1
    //   112: invokeinterface 331 1 0
    //   117: aload_0
    //   118: getfield 286	org/eclipse/team/ui/synchronize/SyncInfoCompareInput:node	Lorg/eclipse/team/ui/synchronize/SyncInfoCompareInput$MyDiffNode;
    //   121: areturn
    // Line number table:
    //   Java source line #169	-> byte code offset #0
    //   Java source line #170	-> byte code offset #8
    //   Java source line #171	-> byte code offset #19
    //   Java source line #173	-> byte code offset #28
    //   Java source line #174	-> byte code offset #35
    //   Java source line #176	-> byte code offset #61
    //   Java source line #177	-> byte code offset #76
    //   Java source line #179	-> byte code offset #92
    //   Java source line #180	-> byte code offset #93
    //   Java source line #181	-> byte code offset #102
    //   Java source line #182	-> byte code offset #103
    //   Java source line #183	-> byte code offset #109
    //   Java source line #182	-> byte code offset #111
    //   Java source line #184	-> byte code offset #117
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	122	0	this	SyncInfoCompareInput
    //   0	122	1	monitor	IProgressMonitor
    //   92	6	2	e	org.eclipse.team.core.TeamException
    //   102	8	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   28	89	92	org/eclipse/team/core/TeamException
    //   28	102	102	finally
  }
  
  public String getToolTipText()
  {
    return NLS.bind(TeamUIMessages.SyncInfoCompareInput_tooltip, new String[] { Utils.shortenText(30, description), node.getResource().getFullPath().toString() });
  }
  
  public boolean equals(Object other)
  {
    if (other == this) {
      return true;
    }
    if ((other instanceof SyncInfoCompareInput))
    {
      SyncInfo otherSyncInfo = ((SyncInfoCompareInput)other).getSyncInfo();
      SyncInfo thisSyncInfo = getSyncInfo();
      
      return (thisSyncInfo.equals(otherSyncInfo)) && (node.getLeft().equals(node.getLeft()));
    }
    return false;
  }
  
  public int hashCode()
  {
    return getSyncInfo().hashCode();
  }
  
  public SyncInfo getSyncInfo()
  {
    return node.getSyncInfo();
  }
  
  public boolean canRunAsJob()
  {
    return true;
  }
  
  public synchronized ICompareNavigator getNavigator()
  {
    if ((synchronizeConfiguration != null) && (isSelectedInSynchronizeView()))
    {
      ICompareNavigator nav = (ICompareNavigator)synchronizeConfiguration.getProperty("org.eclipse.team.ui.P_NAVIGATOR");
      synchronizeConfiguration.setProperty("org.eclipse.team.ui.P_INPUT_NAVIGATOR", super.getNavigator());
      return nav;
    }
    return super.getNavigator();
  }
  
  private boolean isSelectedInSynchronizeView()
  {
    if (synchronizeConfiguration != null)
    {
      ISelection s = synchronizeConfiguration.getSite().getSelectionProvider().getSelection();
      if ((s instanceof IStructuredSelection))
      {
        IStructuredSelection ss = (IStructuredSelection)s;
        Object element = ss.getFirstElement();
        if ((element instanceof SyncInfoModelElement))
        {
          SyncInfoModelElement sime = (SyncInfoModelElement)element;
          return sime.getSyncInfo().getLocal().equals(resource);
        }
      }
    }
    return false;
  }
  
  protected void fireInputChange()
  {
    node.fireChange();
  }
}

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

import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class SynchronizeModelAction$1
  implements DisposeListener
{
  final SynchronizeModelAction this$0;
  private final ISelectionProvider val$selectionProvider;
  
  SynchronizeModelAction$1(SynchronizeModelAction paramSynchronizeModelAction, ISelectionProvider paramISelectionProvider)
  {
    this$0 = paramSynchronizeModelAction;val$selectionProvider = paramISelectionProvider;
  }
  
  public void widgetDisposed(DisposeEvent e)
  {
    val$selectionProvider.removeSelectionChangedListener(this$0);
  }
}

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

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.team.core.synchronize.FastSyncInfoFilter;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
import org.eclipse.ui.actions.BaseSelectionListenerAction;
import org.eclipse.ui.ide.IDE;

public abstract class SynchronizeModelAction
  extends BaseSelectionListenerAction
{
  private ISynchronizePageConfiguration configuration;
  
  protected SynchronizeModelAction(String text, ISynchronizePageConfiguration configuration)
  {
    this(text, configuration, configuration.getSite().getSelectionProvider());
  }
  
  protected SynchronizeModelAction(String text, ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider)
  {
    super(text);
    this.configuration = configuration;
    initialize(configuration, selectionProvider);
  }
  
  protected void initialize(ISynchronizePageConfiguration configuration, ISelectionProvider selectionProvider)
  {
    selectionProvider.addSelectionChangedListener(this);
    configuration.getPage().getViewer().getControl().addDisposeListener(new DisposeListener()
    {
      private final ISelectionProvider val$selectionProvider;
      
      public void widgetDisposed(DisposeEvent e)
      {
        val$selectionProvider.removeSelectionChangedListener(SynchronizeModelAction.this);
      }
    });
  }
  
  public void run()
  {
    if ((needsToSaveDirtyEditors()) && 
      (!saveAllEditors(confirmSaveOfDirtyEditor()))) {
      return;
    }
    try
    {
      runOperation();
    }
    catch (InvocationTargetException e)
    {
      handle(e);
    }
    catch (InterruptedException e)
    {
      handle(e);
    }
  }
  
  protected void runOperation()
    throws InvocationTargetException, InterruptedException
  {
    getSubscriberOperation(configuration, getFilteredDiffElements()).run();
  }
  
  protected boolean needsToSaveDirtyEditors()
  {
    return true;
  }
  
  protected boolean confirmSaveOfDirtyEditor()
  {
    return true;
  }
  
  protected abstract SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration paramISynchronizePageConfiguration, IDiffElement[] paramArrayOfIDiffElement);
  
  protected void handle(Exception e)
  {
    Utils.handle(e);
  }
  
  protected boolean updateSelection(IStructuredSelection selection)
  {
    super.updateSelection(selection);
    return isEnabledForSelection(selection);
  }
  
  private boolean isEnabledForSelection(IStructuredSelection selection)
  {
    return Utils.hasMatchingDescendant(selection, getSyncInfoFilter());
  }
  
  protected final IDiffElement[] getSelectedDiffElements()
  {
    return Utils.getDiffNodes(getStructuredSelection().toArray());
  }
  
  protected FastSyncInfoFilter getSyncInfoFilter()
  {
    return new FastSyncInfoFilter();
  }
  
  protected final IDiffElement[] getFilteredDiffElements()
  {
    IDiffElement[] elements = getSelectedDiffElements();
    List filtered = new ArrayList();
    for (int i = 0; i < elements.length; i++)
    {
      IDiffElement e = elements[i];
      if ((e instanceof SyncInfoModelElement))
      {
        SyncInfo info = ((SyncInfoModelElement)e).getSyncInfo();
        if ((info != null) && (getSyncInfoFilter().select(info))) {
          filtered.add(e);
        }
      }
    }
    return (IDiffElement[])filtered.toArray(new IDiffElement[filtered.size()]);
  }
  
  public void selectionChanged(ISelection selection)
  {
    if ((selection instanceof IStructuredSelection)) {
      super.selectionChanged((IStructuredSelection)selection);
    } else {
      super.selectionChanged(StructuredSelection.EMPTY);
    }
  }
  
  public ISynchronizePageConfiguration getConfiguration()
  {
    return configuration;
  }
  
  public final boolean saveAllEditors(boolean confirm)
  {
    return IDE.saveAllEditors(Utils.getResources(getFilteredDiffElements()), confirm);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.ui.synchronize.SynchronizeModelAction
 * 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.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement;
import org.eclipse.team.ui.TeamOperation;
import org.eclipse.ui.IWorkbenchPart;

public abstract class SynchronizeModelOperation
  extends TeamOperation
{
  private IDiffElement[] elements;
  
  private static IWorkbenchPart getPart(ISynchronizePageConfiguration configuration)
  {
    if (configuration != null)
    {
      ISynchronizePageSite site = configuration.getSite();
      if (site != null) {
        return site.getPart();
      }
    }
    return null;
  }
  
  private static IRunnableContext getRunnableContext(ISynchronizePageConfiguration configuration)
  {
    if (configuration != null) {
      return configuration.getRunnableContext();
    }
    return null;
  }
  
  protected SynchronizeModelOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements)
  {
    super(getPart(configuration), getRunnableContext(configuration));
    this.elements = elements;
  }
  
  protected SyncInfoSet getSyncInfoSet()
  {
    return makeSyncInfoSetFromSelection(getSyncInfos());
  }
  
  public void scheduled(IJobChangeEvent event)
  {
    super.scheduled(event);
    markBusy(elements, true);
  }
  
  public void done(IJobChangeEvent event)
  {
    markBusy(elements, false);
    super.done(event);
  }
  
  private void markBusy(IDiffElement[] elements, boolean isBusy)
  {
    for (int i = 0; i < elements.length; i++)
    {
      IDiffElement element = elements[i];
      if ((element instanceof ISynchronizeModelElement)) {
        ((ISynchronizeModelElement)element).setPropertyToRoot("org.eclipse.team.ui.busy", isBusy);
      }
    }
  }
  
  private SyncInfo[] getSyncInfos()
  {
    List filtered = new ArrayList();
    for (int i = 0; i < elements.length; i++)
    {
      IDiffElement e = elements[i];
      if ((e instanceof SyncInfoModelElement)) {
        filtered.add(((SyncInfoModelElement)e).getSyncInfo());
      }
    }
    return (SyncInfo[])filtered.toArray(new SyncInfo[filtered.size()]);
  }
  
  private SyncInfoSet makeSyncInfoSetFromSelection(SyncInfo[] infos)
  {
    return new SyncInfoSet(infos);
  }
}

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

import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class SynchronizePageActionGroup$1
  extends SafeRunnable
{
  final SynchronizePageActionGroup.VisibleRootsSelectionProvider this$1;
  private final ISelectionChangedListener val$l;
  private final SelectionChangedEvent val$event;
  
  SynchronizePageActionGroup$1(SynchronizePageActionGroup.VisibleRootsSelectionProvider paramVisibleRootsSelectionProvider, ISelectionChangedListener paramISelectionChangedListener, SelectionChangedEvent paramSelectionChangedEvent)
  {
    this$1 = paramVisibleRootsSelectionProvider;val$l = paramISelectionChangedListener;val$event = paramSelectionChangedEvent;
  }
  
  public void run()
  {
    val$l.selectionChanged(val$event);
  }
}

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

import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;

class SynchronizePageActionGroup$VisibleRootsSelectionProvider
  extends SynchronizePageActionGroup
  implements ISelectionProvider
{
  private ListenerList selectionChangedListeners;
  private ISelection selection;
  final SynchronizePageActionGroup this$0;
  
  protected SynchronizePageActionGroup$VisibleRootsSelectionProvider(SynchronizePageActionGroup paramSynchronizePageActionGroup, ISynchronizeModelElement element)
  {
    this$0 = paramSynchronizePageActionGroup;selectionChangedListeners = new ListenerList(1);
    modelChanged(element);
  }
  
  public void modelChanged(ISynchronizeModelElement root)
  {
    if (root == null) {
      setSelection(StructuredSelection.EMPTY);
    } else {
      setSelection(new StructuredSelection(root));
    }
  }
  
  public void addSelectionChangedListener(ISelectionChangedListener listener)
  {
    selectionChangedListeners.add(listener);
  }
  
  public void removeSelectionChangedListener(ISelectionChangedListener listener)
  {
    selectionChangedListeners.remove(listener);
  }
  
  public ISelection getSelection()
  {
    return selection;
  }
  
  public void setSelection(ISelection selection)
  {
    this.selection = selection;
    selectionChanged(new SelectionChangedEvent(this, getSelection()));
  }
  
  private void selectionChanged(SelectionChangedEvent event)
  {
    Object[] listeners = selectionChangedListeners.getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
      SafeRunner.run(new SynchronizePageActionGroup.1(this, l, event));
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.ui.synchronize.SynchronizePageActionGroup.VisibleRootsSelectionProvider
 * 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.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.actions.ActionGroup;

public abstract class SynchronizePageActionGroup
  extends ActionGroup
{
  private ISynchronizePageConfiguration configuration;
  private Map menuContributions = new HashMap();
  private VisibleRootsSelectionProvider visibleRootSelectionProvider;
  
  private class VisibleRootsSelectionProvider
    extends SynchronizePageActionGroup
    implements ISelectionProvider
  {
    private ListenerList selectionChangedListeners = new ListenerList(1);
    private ISelection selection;
    
    protected VisibleRootsSelectionProvider(ISynchronizeModelElement element)
    {
      modelChanged(element);
    }
    
    public void modelChanged(ISynchronizeModelElement root)
    {
      if (root == null) {
        setSelection(StructuredSelection.EMPTY);
      } else {
        setSelection(new StructuredSelection(root));
      }
    }
    
    public void addSelectionChangedListener(ISelectionChangedListener listener)
    {
      selectionChangedListeners.add(listener);
    }
    
    public void removeSelectionChangedListener(ISelectionChangedListener listener)
    {
      selectionChangedListeners.remove(listener);
    }
    
    public ISelection getSelection()
    {
      return selection;
    }
    
    public void setSelection(ISelection selection)
    {
      this.selection = selection;
      selectionChanged(new SelectionChangedEvent(this, getSelection()));
    }
    
    private void selectionChanged(SelectionChangedEvent event)
    {
      Object[] listeners = selectionChangedListeners.getListeners();
      for (int i = 0; i < listeners.length; i++)
      {
        ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
        SafeRunner.run(new SynchronizePageActionGroup.1(this, l, event));
      }
    }
  }
  
  public void initialize(ISynchronizePageConfiguration configuration)
  {
    this.configuration = configuration;
    if (visibleRootSelectionProvider != null) {
      configuration.addActionContribution(visibleRootSelectionProvider);
    }
  }
  
  public void modelChanged(ISynchronizeModelElement root) {}
  
  public void dispose()
  {
    super.dispose();
    if (configuration != null) {
      configuration.removeActionContribution(this);
    }
  }
  
  protected IContributionItem findGroup(IContributionManager menu, String groupId)
  {
    if (menu == null) {
      return null;
    }
    IContributionItem item = menu.find(((SynchronizePageConfiguration)configuration).getGroupId(groupId));
    if (item == null) {
      item = menu.find(groupId);
    }
    return item;
  }
  
  protected boolean appendToGroup(IContributionManager manager, String groupId, IAction action)
  {
    if (internalAppendToGroup(manager, groupId, action))
    {
      registerActionWithWorkbench(action);
      return true;
    }
    return false;
  }
  
  private boolean internalAppendToGroup(IContributionManager manager, String groupId, IAction action)
  {
    if ((manager == null) || (action == null)) {
      return false;
    }
    IContributionItem group = findGroup(manager, groupId);
    if (group != null)
    {
      manager.appendToGroup(group.getId(), action);
      return true;
    }
    return false;
  }
  
  protected boolean appendToGroup(IContributionManager manager, String groupId, IContributionItem item)
  {
    if ((manager == null) || (item == null)) {
      return false;
    }
    IContributionItem group = findGroup(manager, groupId);
    if (group != null)
    {
      manager.appendToGroup(group.getId(), item);
      return true;
    }
    return false;
  }
  
  protected void appendToGroup(String menuId, String groupId, IAction action)
  {
    registerActionWithWorkbench(action);
    internalAppendToGroup(menuId, groupId, action);
  }
  
  private void registerActionWithWorkbench(IAction action)
  {
    ISynchronizePageSite site = configuration.getSite();
    String id = action.getId();
    if (id != null)
    {
      site.getActionBars().setGlobalActionHandler(id, action);
      IKeyBindingService keyBindingService = site.getKeyBindingService();
      if (keyBindingService != null) {
        keyBindingService.registerAction(action);
      }
    }
  }
  
  protected void appendToGroup(String menuId, String groupId, IContributionItem item)
  {
    internalAppendToGroup(menuId, groupId, item);
  }
  
  protected ISelectionProvider getVisibleRootsSelectionProvider()
  {
    if (visibleRootSelectionProvider == null)
    {
      ISynchronizeModelElement root = null;
      if (configuration != null) {
        root = (ISynchronizeModelElement)configuration.getProperty("org.eclipse.team.ui.P_MODEL");
      }
      visibleRootSelectionProvider = new VisibleRootsSelectionProvider(root);
      if (configuration != null) {
        configuration.addActionContribution(visibleRootSelectionProvider);
      }
    }
    return visibleRootSelectionProvider;
  }
  
  public void fillContextMenu(IMenuManager menu)
  {
    super.fillContextMenu(menu);
    fillMenu(menu, "org.eclipse.team.ui.P_CONTEXT_MENU");
  }
  
  public void fillActionBars(IActionBars actionBars)
  {
    super.fillActionBars(actionBars);
    if (actionBars != null)
    {
      fillMenu(actionBars.getMenuManager(), "org.eclipse.team.ui.P_VIEW_MENU");
      fillMenu(actionBars.getToolBarManager(), "org.eclipse.team.ui.P_TOOLBAR_MENU");
    }
  }
  
  private void fillMenu(IContributionManager menu, String menuId)
  {
    Map groups = (Map)menuContributions.get(menuId);
    if ((menu != null) && (groups != null)) {
      for (Iterator iter = groups.keySet().iterator(); iter.hasNext();)
      {
        String groupId = (String)iter.next();
        List actions = (List)groups.get(groupId);
        if (actions != null) {
          for (Iterator iter2 = actions.iterator(); iter2.hasNext();)
          {
            Object element = iter2.next();
            if ((element instanceof IAction)) {
              internalAppendToGroup(menu, groupId, (IAction)element);
            } else if ((element instanceof IContributionItem)) {
              appendToGroup(menu, groupId, (IContributionItem)element);
            }
          }
        }
      }
    }
  }
  
  private void internalAppendToGroup(String menuId, String groupId, Object action)
  {
    Map groups = (Map)menuContributions.get(menuId);
    if (groups == null)
    {
      groups = new HashMap();
      menuContributions.put(menuId, groups);
    }
    List actions = (List)groups.get(groupId);
    if (actions == null)
    {
      actions = new ArrayList();
      groups.put(groupId, actions);
    }
    actions.add(action);
  }
  
  public ISynchronizePageConfiguration getConfiguration()
  {
    return configuration;
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.subscribers.ISubscriberChangeEvent;
import org.eclipse.team.ui.mapping.ITeamStateChangeEvent;

public class TeamStateChangeEvent
  implements ITeamStateChangeEvent
{
  private Set changes = new HashSet();
  private Set addedRoots = new HashSet();
  private Set removedRoots = new HashSet();
  
  public TeamStateChangeEvent() {}
  
  public TeamStateChangeEvent(ISubscriberChangeEvent[] deltas)
  {
    for (int i = 0; i < deltas.length; i++)
    {
      ISubscriberChangeEvent event = deltas[i];
      IResource resource = event.getResource();
      if ((event.getFlags() & 0x2) != 0) {
        rootAdded(resource);
      }
      if ((event.getFlags() & 0x4) != 0) {
        rootRemoved(resource);
      }
      if ((event.getFlags() & 0x1) != 0) {
        changed(resource);
      }
      while (resource.getType() != 4)
      {
        resource = resource.getParent();
        changed(resource);
      }
    }
  }
  
  public void changed(IResource resource)
  {
    changes.add(resource);
  }
  
  public void rootRemoved(IResource resource)
  {
    removedRoots.add(resource);
  }
  
  public void rootAdded(IResource resource)
  {
    addedRoots.add(resource);
  }
  
  public IResource[] getAddedRoots()
  {
    return (IResource[])addedRoots.toArray(new IResource[addedRoots.size()]);
  }
  
  public IResource[] getRemovedRoots()
  {
    return (IResource[])removedRoots.toArray(new IResource[removedRoots.size()]);
  }
  
  public IResource[] getChangedResources()
  {
    return (IResource[])changes.toArray(new IResource[changes.size()]);
  }
  
  public boolean hasChange(IResource resource)
  {
    if (changes.contains(resource)) {
      return true;
    }
    if (isChildOfChangedRoot(resource)) {
      return true;
    }
    return false;
  }
  
  private boolean isChildOfChangedRoot(IResource resource)
  {
    if ((resource == null) || (resource.getType() == 8)) {
      return false;
    }
    if ((addedRoots.contains(resource)) || (removedRoots.contains(resource))) {
      return true;
    }
    return isChildOfChangedRoot(resource.getParent());
  }
}

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

import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.eclipse.team.ui.mapping.ITeamStateDescription;

public class TeamStateDescription
  implements ITeamStateDescription
{
  private int state;
  private Map properties = new HashMap();
  
  public TeamStateDescription(int state)
  {
    this.state = state;
  }
  
  public int getStateFlags()
  {
    return state;
  }
  
  public int getKind()
  {
    return getStateFlags() & 0xFF;
  }
  
  public int getDirection()
  {
    return getStateFlags() & 0x300;
  }
  
  public String[] getPropertyNames()
  {
    return (String[])properties.keySet().toArray(new String[properties.size()]);
  }
  
  public Object getProperty(String property)
  {
    return properties.get(property);
  }
  
  public void setProperty(String property, Object value)
  {
    properties.put(property, value);
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof TeamStateDescription))
    {
      TeamStateDescription dsd = (TeamStateDescription)obj;
      if ((dsd.getStateFlags() == state) && 
        (haveSameProperties(this, dsd)))
      {
        String[] properties = getPropertyNames();
        for (int i = 0; i < properties.length; i++)
        {
          String property = properties[i];
          Object o1 = getProperty(property);
          Object o2 = dsd.getProperty(property);
          if (!o1.equals(o2)) {
            return false;
          }
        }
        return true;
      }
      return false;
    }
    return super.equals(obj);
  }
  
  private boolean haveSameProperties(TeamStateDescription d1, TeamStateDescription d2)
  {
    String[] p1 = d1.getPropertyNames();
    String[] p2 = d2.getPropertyNames();
    if (p1.length != p2.length) {
      return false;
    }
    for (int i = 0; i < p1.length; i++)
    {
      String s1 = p1[i];
      boolean found = false;
      for (int j = 0; j < p2.length; j++)
      {
        String s2 = p2[j];
        if (s1.equals(s2))
        {
          found = true;
          break;
        }
      }
      if (!found) {
        return false;
      }
    }
    return true;
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.team.ui.mapping.ITeamStateChangeEvent;
import org.eclipse.team.ui.mapping.ITeamStateChangeListener;

class TeamStateProvider$1
  implements ISafeRunnable
{
  final TeamStateProvider this$0;
  private final ITeamStateChangeListener val$listener;
  private final ITeamStateChangeEvent val$event;
  
  TeamStateProvider$1(TeamStateProvider paramTeamStateProvider, ITeamStateChangeListener paramITeamStateChangeListener, ITeamStateChangeEvent paramITeamStateChangeEvent)
  {
    this$0 = paramTeamStateProvider;val$listener = paramITeamStateChangeListener;val$event = paramITeamStateChangeEvent;
  }
  
  public void run()
    throws Exception
  {
    val$listener.teamStateChanged(val$event);
  }
  
  public void handleException(Throwable exception) {}
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.registry.TeamDecoratorDescription;
import org.eclipse.team.internal.ui.registry.TeamDecoratorManager;
import org.eclipse.team.ui.mapping.ITeamStateChangeEvent;
import org.eclipse.team.ui.mapping.ITeamStateChangeListener;
import org.eclipse.team.ui.mapping.ITeamStateProvider;
import org.eclipse.ui.IDecoratorManager;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

public abstract class TeamStateProvider
  implements ITeamStateProvider
{
  private ListenerList listeners = new ListenerList(1);
  
  public boolean isDecorationEnabled(Object element)
  {
    ResourceMapping mapping = Utils.getResourceMapping(element);
    if (mapping != null)
    {
      IProject[] projects = mapping.getProjects();
      return internalIsDecorationEnabled(projects);
    }
    return false;
  }
  
  public int getDecoratedStateMask(Object element)
  {
    ResourceMapping mapping = Utils.getResourceMapping(element);
    if (mapping != null)
    {
      IProject[] projects = mapping.getProjects();
      return internalGetDecoratedStateMask(projects);
    }
    return 0;
  }
  
  public void addDecoratedStateChangeListener(ITeamStateChangeListener listener)
  {
    listeners.add(listener);
  }
  
  public void removeDecoratedStateChangeListener(ITeamStateChangeListener listener)
  {
    listeners.remove(listener);
  }
  
  protected final void fireStateChangeEvent(ITeamStateChangeEvent event)
  {
    Object[] allListeners = listeners.getListeners();
    for (int i = 0; i < allListeners.length; i++)
    {
      ITeamStateChangeListener listener = (ITeamStateChangeListener)allListeners[i];
      SafeRunner.run(new ISafeRunnable()
      {
        private final ITeamStateChangeListener val$listener;
        private final ITeamStateChangeEvent val$event;
        
        public void run()
          throws Exception
        {
          val$listener.teamStateChanged(val$event);
        }
        
        public void handleException(Throwable exception) {}
      });
    }
  }
  
  private int internalGetDecoratedStateMask(IProject[] projects)
  {
    int stateMask = 0;
    String[] providerIds = getProviderIds(projects);
    for (int i = 0; i < providerIds.length; i++)
    {
      String providerId = providerIds[i];
      stateMask |= internalGetDecoratedStateMask(providerId);
    }
    return stateMask;
  }
  
  private int internalGetDecoratedStateMask(String providerId)
  {
    TeamDecoratorDescription decoratorDescription = 
      TeamDecoratorManager.getInstance().getDecoratorDescription(providerId);
    if (decoratorDescription != null) {
      return decoratorDescription.getDecoratedDirectionFlags();
    }
    return 0;
  }
  
  private String[] getProviderIds(IProject[] projects)
  {
    Set providerIds = new HashSet();
    for (int i = 0; i < projects.length; i++)
    {
      IProject project = projects[i];
      String id = getProviderId(project);
      if (id != null) {
        providerIds.add(id);
      }
    }
    return (String[])providerIds.toArray(new String[providerIds.size()]);
  }
  
  private String getProviderId(IProject project)
  {
    RepositoryProvider provider = RepositoryProvider.getProvider(project);
    if (provider != null) {
      return provider.getID();
    }
    return null;
  }
  
  private boolean internalIsDecorationEnabled(IProject[] projects)
  {
    String[] providerIds = getProviderIds(projects);
    for (int i = 0; i < providerIds.length; i++)
    {
      String providerId = providerIds[i];
      if (internalIsDecorationEnabled(providerId)) {
        return true;
      }
    }
    return false;
  }
  
  private boolean internalIsDecorationEnabled(String providerId)
  {
    String decoratorId = getDecoratorId(providerId);
    if (decoratorId != null) {
      return PlatformUI.getWorkbench().getDecoratorManager().getEnabled(
        decoratorId);
    }
    return false;
  }
  
  private String getDecoratorId(String providerId)
  {
    TeamDecoratorDescription decoratorDescription = 
      TeamDecoratorManager.getInstance().getDecoratorDescription(providerId);
    if (decoratorDescription != null) {
      return decoratorDescription.getDecoratorId();
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.ui.synchronize.TeamStateProvider
 * 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.HashSet;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.IWorkingSetManager;
import org.eclipse.ui.PlatformUI;

public class WorkingSetScope
  extends AbstractSynchronizeScope
  implements IPropertyChangeListener
{
  private static final String CTX_SETS = "workingset_scope_sets";
  private static final String CTX_SET_NAME = "workingset_scope_name";
  private IWorkingSet[] sets;
  
  public WorkingSetScope(IWorkingSet[] sets)
  {
    setWorkingSets(sets);
  }
  
  protected WorkingSetScope(IMemento memento)
  {
    super(memento);
  }
  
  protected void setWorkingSets(IWorkingSet[] sets)
  {
    this.sets = sets;
    PlatformUI.getWorkbench().getWorking
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