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

n: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ui.mapping;

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.ui.navigator.CommonViewer;

class CommonViewerAdvisor$1
  implements ISynchronizationScopeChangeListener
{
  private final CommonViewer val$v;
  private final ISynchronizePageConfiguration val$configuration;
  
  CommonViewerAdvisor$1(CommonViewer paramCommonViewer, ISynchronizePageConfiguration paramISynchronizePageConfiguration)
  {
    val$v = paramCommonViewer;val$configuration = paramISynchronizePageConfiguration;
  }
  
  public void scopeChanged(ISynchronizationScope scope, ResourceMapping[] newMappings, ResourceTraversal[] newTraversals)
  {
    CommonViewerAdvisor.access$0(val$v, val$configuration);
    Utils.asyncExec(new CommonViewerAdvisor.2(this, val$v), 
    
      val$v);
  }
}

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

import org.eclipse.ui.navigator.CommonViewer;

class CommonViewerAdvisor$2
  implements Runnable
{
  final CommonViewerAdvisor.1 this$1;
  private final CommonViewer val$v;
  
  CommonViewerAdvisor$2(CommonViewerAdvisor.1 param1, CommonViewer paramCommonViewer)
  {
    this$1 = param1;val$v = paramCommonViewer;
  }
  
  public void run()
  {
    val$v.refresh();
  }
}

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

import org.eclipse.team.ui.mapping.SynchronizationStateTester;

class CommonViewerAdvisor$3
  extends SynchronizationStateTester
{
  final CommonViewerAdvisor this$0;
  
  CommonViewerAdvisor$3(CommonViewerAdvisor paramCommonViewerAdvisor)
  {
    this$0 = paramCommonViewerAdvisor;
  }
  
  public boolean isStateDecorationEnabled()
  {
    return false;
  }
}

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

import org.eclipse.team.ui.mapping.SynchronizationStateTester;

class CommonViewerAdvisor$4
  extends SynchronizationStateTester
{
  final CommonViewerAdvisor this$0;
  
  CommonViewerAdvisor$4(CommonViewerAdvisor paramCommonViewerAdvisor)
  {
    this$0 = paramCommonViewerAdvisor;
  }
  
  public boolean isStateDecorationEnabled()
  {
    return false;
  }
}

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

import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.Viewer;

class CommonViewerAdvisor$5
  implements Runnable
{
  final CommonViewerAdvisor this$0;
  private final PropertyChangeEvent val$event;
  private final Viewer val$viewer;
  
  CommonViewerAdvisor$5(CommonViewerAdvisor paramCommonViewerAdvisor, PropertyChangeEvent paramPropertyChangeEvent, Viewer paramViewer)
  {
    this$0 = paramCommonViewerAdvisor;val$event = paramPropertyChangeEvent;val$viewer = paramViewer;
  }
  
  public void run()
  {
    Object viewerInput = ModelSynchronizePage.getViewerInput(this$0.getConfiguration(), (String)val$event.getNewValue());
    if ((val$viewer != null) && (viewerInput != null)) {
      val$viewer.setInput(viewerInput);
    }
  }
}

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

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.jface.action.IAction;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.SubActionBars;

class CommonViewerAdvisor$CommonSubActionBars
  extends SubActionBars
{
  final CommonViewerAdvisor this$0;
  
  public CommonViewerAdvisor$CommonSubActionBars(CommonViewerAdvisor paramCommonViewerAdvisor, IActionBars parent)
  {
    super(parent);
    this$0 = paramCommonViewerAdvisor;
  }
  
  public void setGlobalActionHandler(String actionID, IAction handler)
  {
    if (handler == null)
    {
      if (getGlobalActionHandler(actionID) != null)
      {
        getParent().setGlobalActionHandler(actionID, null);
        super.setGlobalActionHandler(actionID, null);
      }
    }
    else
    {
      if (getParent().getGlobalActionHandler(actionID) != null)
      {
        TeamUIPlugin.log(new TeamException(NLS.bind("Conflicting attempt to set action id {0} detected", actionID)));
        return;
      }
      super.setGlobalActionHandler(actionID, handler);
    }
  }
  
  public void clearGlobalActionHandlers()
  {
    Map handlers = getGlobalActionHandlers();
    if (handlers != null)
    {
      Set keys = handlers.keySet();
      Iterator iter = keys.iterator();
      while (iter.hasNext())
      {
        String actionId = (String)iter.next();
        getParent().setGlobalActionHandler(actionId, 
          null);
      }
    }
    super.clearGlobalActionHandlers();
  }
  
  public void updateActionBars()
  {
    Map newActionHandlers = getGlobalActionHandlers();
    if (newActionHandlers != null)
    {
      Set keys = newActionHandlers.entrySet();
      Iterator iter = keys.iterator();
      while (iter.hasNext())
      {
        Map.Entry entry = (Map.Entry)iter.next();
        getParent().setGlobalActionHandler((String)entry.getKey(), 
          (IAction)entry.getValue());
      }
    }
    super.updateActionBars();
  }
}

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

import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.graphics.Font;

class CommonViewerAdvisor$MyDecoratingStyledCellLabelProvider
  extends DecoratingStyledCellLabelProvider
  implements DelegatingStyledCellLabelProvider.IStyledLabelProvider, IFontProvider
{
  private DelegatingStyledCellLabelProvider.IStyledLabelProvider slp;
  final CommonViewerAdvisor this$0;
  
  public CommonViewerAdvisor$MyDecoratingStyledCellLabelProvider(CommonViewerAdvisor paramCommonViewerAdvisor, DelegatingStyledCellLabelProvider.IStyledLabelProvider slp, ILabelDecorator decorator)
  {
    super(slp, decorator, null);this$0 = paramCommonViewerAdvisor;
    this.slp = slp;
  }
  
  public StyledString getStyledText(Object element)
  {
    return slp.getStyledText(element);
  }
  
  public Font getFont(Object element)
  {
    return super.getFont(element);
  }
}

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

import java.util.ArrayList;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.team.internal.ui.synchronize.AbstractTreeViewerAdvisor.ITreeViewerAccessor;
import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.navigator.INavigatorContentService;
import org.eclipse.ui.navigator.INavigatorDnDService;

public final class CommonViewerAdvisor$NavigableCommonViewer
  extends CommonViewer
  implements AbstractTreeViewerAdvisor.ITreeViewerAccessor
{
  private final IEmptyTreeListener listener;
  private boolean empty;
  
  CommonViewerAdvisor$NavigableCommonViewer(String paramString, Composite paramComposite, int paramInt, IEmptyTreeListener paramIEmptyTreeListener, NavigableCommonViewer paramNavigableCommonViewer)
  {
    this(paramString, paramComposite, paramInt, paramIEmptyTreeListener);
  }
  
  private CommonViewerAdvisor$NavigableCommonViewer(String id, Composite parent, int style, IEmptyTreeListener listener)
  {
    super(id, parent, style);
    this.listener = listener;
  }
  
  public void createChildren(TreeItem item)
  {
    super.createChildren(item);
  }
  
  public void openSelection()
  {
    fireOpen(new OpenEvent(this, getSelection()));
  }
  
  protected void internalRefresh(Object element, boolean updateLabels)
  {
    TreePath[] expanded = getVisibleExpandedPaths();
    super.internalRefresh(element, updateLabels);
    setExpandedTreePaths(expanded);
    checkForEmptyViewer();
  }
  
  protected void internalRemove(Object parent, Object[] elements)
  {
    super.internalRemove(parent, elements);
    if (parent == getInput()) {
      checkForEmptyViewer();
    }
  }
  
  protected void internalRemove(Object[] elements)
  {
    super.internalRemove(elements);
    checkForEmptyViewer();
  }
  
  protected void internalAdd(Widget widget, Object parentElement, Object[] childElements)
  {
    super.internalAdd(widget, parentElement, childElements);
    if (empty)
    {
      empty = false;
      listener.notEmpty(this);
    }
  }
  
  protected void inputChanged(Object input, Object oldInput)
  {
    super.inputChanged(input, oldInput);
    checkForEmptyViewer();
  }
  
  private void checkForEmptyViewer()
  {
    Object input = getInput();
    if (input != null)
    {
      Widget w = findItem(input);
      Item[] children = getChildren(w);
      if (children.length == 0)
      {
        if (!empty)
        {
          empty = true;
          listener.treeEmpty(this);
        }
        return;
      }
    }
    empty = false;
    if (listener != null) {
      listener.notEmpty(this);
    }
  }
  
  public boolean isEmpty()
  {
    return empty;
  }
  
  protected void initDragAndDrop()
  {
    getNavigatorContentService().getDnDService().bindDragAssistant(new ResourceDragAdapterAssistant());
    super.initDragAndDrop();
  }
  
  public TreePath[] getVisibleExpandedPaths()
  {
    ArrayList v = new ArrayList();
    internalCollectVisibleExpanded(v, getControl());
    return (TreePath[])v.toArray(new TreePath[v.size()]);
  }
  
  private void internalCollectVisibleExpanded(ArrayList result, Widget widget)
  {
    Item[] items = getChildren(widget);
    for (int i = 0; i < items.length; i++)
    {
      Item item = items[i];
      if (getExpanded(item))
      {
        TreePath path = getTreePathFromItem(item);
        if (path != null) {
          result.add(path);
        }
        internalCollectVisibleExpanded(result, item);
      }
    }
  }
}

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

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.resources.mapping.IModelProviderDescriptor;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.DecoratingStyledCellLabelProvider;
import org.eclipse.jface.viewers.DecorationContext;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.core.mapping.ISynchronizationScopeChangeListener;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.synchronize.AbstractTreeViewerAdvisor;
import org.eclipse.team.internal.ui.synchronize.AbstractTreeViewerAdvisor.ITreeViewerAccessor;
import org.eclipse.team.internal.ui.synchronize.SynchronizePageConfiguration;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.mapping.ITeamContentProviderDescriptor;
import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
import org.eclipse.team.ui.mapping.SynchronizationStateTester;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizePageSite;
import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IDecoratorManager;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.SubActionBars;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.navigator.CommonViewer;
import org.eclipse.ui.navigator.CommonViewerSiteFactory;
import org.eclipse.ui.navigator.CommonViewerSorter;
import org.eclipse.ui.navigator.ICommonViewerSite;
import org.eclipse.ui.navigator.IExtensionStateModel;
import org.eclipse.ui.navigator.INavigatorActivationService;
import org.eclipse.ui.navigator.INavigatorContentExtension;
import org.eclipse.ui.navigator.INavigatorContentService;
import org.eclipse.ui.navigator.INavigatorContentServiceListener;
import org.eclipse.ui.navigator.INavigatorDnDService;
import org.eclipse.ui.navigator.INavigatorViewerDescriptor;
import org.eclipse.ui.navigator.NavigatorActionService;
import org.eclipse.ui.part.IPageSite;

public class CommonViewerAdvisor
  extends AbstractTreeViewerAdvisor
  implements INavigatorContentServiceListener, IEmptyTreeListener, IPropertyChangeListener
{
  public static final String TEAM_NAVIGATOR_CONTENT = "org.eclipse.team.ui.navigatorViewer";
  private static final String PROP_ACTION_SERVICE_ACTION_BARS = "org.eclipse.team.ui.actionServiceActionBars";
  
  public static final class NavigableCommonViewer
    extends CommonViewer
    implements AbstractTreeViewerAdvisor.ITreeViewerAccessor
  {
    private final IEmptyTreeListener listener;
    private boolean empty;
    
    NavigableCommonViewer(String paramString, Composite paramComposite, int paramInt, IEmptyTreeListener paramIEmptyTreeListener, NavigableCommonViewer paramNavigableCommonViewer)
    {
      this(paramString, paramComposite, paramInt, paramIEmptyTreeListener);
    }
    
    private NavigableCommonViewer(String id, Composite parent, int style, IEmptyTreeListener listener)
    {
      super(parent, style);
      this.listener = listener;
    }
    
    public void createChildren(TreeItem item)
    {
      super.createChildren(item);
    }
    
    public void openSelection()
    {
      fireOpen(new OpenEvent(this, getSelection()));
    }
    
    protected void internalRefresh(Object element, boolean updateLabels)
    {
      TreePath[] expanded = getVisibleExpandedPaths();
      super.internalRefresh(element, updateLabels);
      setExpandedTreePaths(expanded);
      checkForEmptyViewer();
    }
    
    protected void internalRemove(Object parent, Object[] elements)
    {
      super.internalRemove(parent, elements);
      if (parent == getInput()) {
        checkForEmptyViewer();
      }
    }
    
    protected void internalRemove(Object[] elements)
    {
      super.internalRemove(elements);
      checkForEmptyViewer();
    }
    
    protected void internalAdd(Widget widget, Object parentElement, Object[] childElements)
    {
      super.internalAdd(widget, parentElement, childElements);
      if (empty)
      {
        empty = false;
        listener.notEmpty(this);
      }
    }
    
    protected void inputChanged(Object input, Object oldInput)
    {
      super.inputChanged(input, oldInput);
      checkForEmptyViewer();
    }
    
    private void checkForEmptyViewer()
    {
      Object input = getInput();
      if (input != null)
      {
        Widget w = findItem(input);
        Item[] children = getChildren(w);
        if (children.length == 0)
        {
          if (!empty)
          {
            empty = true;
            listener.treeEmpty(this);
          }
          return;
        }
      }
      empty = false;
      if (listener != null) {
        listener.notEmpty(this);
      }
    }
    
    public boolean isEmpty()
    {
      return empty;
    }
    
    protected void initDragAndDrop()
    {
      getNavigatorContentService().getDnDService().bindDragAssistant(new ResourceDragAdapterAssistant());
      super.initDragAndDrop();
    }
    
    public TreePath[] getVisibleExpandedPaths()
    {
      ArrayList v = new ArrayList();
      internalCollectVisibleExpanded(v, getControl());
      return (TreePath[])v.toArray(new TreePath[v.size()]);
    }
    
    private void internalCollectVisibleExpanded(ArrayList result, Widget widget)
    {
      Item[] items = getChildren(widget);
      for (int i = 0; i < items.length; i++)
      {
        Item item = items[i];
        if (getExpanded(item))
        {
          TreePath path = getTreePathFromItem(item);
          if (path != null) {
            result.add(path);
          }
          internalCollectVisibleExpanded(result, item);
        }
      }
    }
  }
  
  private class CommonSubActionBars
    extends SubActionBars
  {
    public CommonSubActionBars(IActionBars parent)
    {
      super();
    }
    
    public void setGlobalActionHandler(String actionID, IAction handler)
    {
      if (handler == null)
      {
        if (getGlobalActionHandler(actionID) != null)
        {
          getParent().setGlobalActionHandler(actionID, null);
          super.setGlobalActionHandler(actionID, null);
        }
      }
      else
      {
        if (getParent().getGlobalActionHandler(actionID) != null)
        {
          TeamUIPlugin.log(new TeamException(NLS.bind("Conflicting attempt to set action id {0} detected", actionID)));
          return;
        }
        super.setGlobalActionHandler(actionID, handler);
      }
    }
    
    public void clearGlobalActionHandlers()
    {
      Map handlers = getGlobalActionHandlers();
      if (handlers != null)
      {
        Set keys = handlers.keySet();
        Iterator iter = keys.iterator();
        while (iter.hasNext())
        {
          String actionId = (String)iter.next();
          getParent().setGlobalActionHandler(actionId, 
            null);
        }
      }
      super.clearGlobalActionHandlers();
    }
    
    public void updateActionBars()
    {
      Map newActionHandlers = getGlobalActionHandlers();
      if (newActionHandlers != null)
      {
        Set keys = newActionHandlers.entrySet();
        Iterator iter = keys.iterator();
        while (iter.hasNext())
        {
          Map.Entry entry = (Map.Entry)iter.next();
          getParent().setGlobalActionHandler((String)entry.getKey(), 
            (IAction)entry.getValue());
        }
      }
      super.updateActionBars();
    }
  }
  
  private Set extensions = new HashSet();
  private NavigatorActionService actionService;
  private IEmptyTreeListener emptyTreeListener;
  
  private static CommonViewer createViewer(Composite parent, ISynchronizePageConfiguration configuration, IEmptyTreeListener listener)
  {
    CommonViewer v = new NavigableCommonViewer(configuration.getViewerId(), parent, 770, listener, null);
    v.setSorter(new CommonViewerSorter());
    v.setSorter(new TeamViewerSorter((CommonViewerSorter)v.getSorter()));
    ISynchronizationScope scope = getScope(configuration);
    bindTeamContentProviders(v);
    scope.addScopeChangeListener(new ISynchronizationScopeChangeListener()
    {
      private final ISynchronizePageConfiguration val$configuration;
      
      public void scopeChanged(ISynchronizationScope scope, ResourceMapping[] newMappings, ResourceTraversal[] newTraversals)
      {
        CommonViewerAdvisor.enableContentProviders(CommonViewerAdvisor.this, val$configuration);
        Utils.asyncExec(new CommonViewerAdvisor.2(this, CommonViewerAdvisor.this), 
        
          CommonViewerAdvisor.this);
      }
    });
    enableContentProviders(v, configuration);
    configuration.getSite().setSelectionProvider(v);
    return v;
  }
  
  private static void enableContentProviders(CommonViewer v, ISynchronizePageConfiguration configuration)
  {
    v.getNavigatorContentService().getActivationService().activateExtensions(getEnabledContentProviders(configuration), true);
  }
  
  private static String[] getEnabledContentProviders(ISynchronizePageConfiguration configuration)
  {
    String visibleModel = (String)configuration.getProperty("org.eclipse.team.ui.activeModelProvider");
    if ((visibleModel != null) && (!visibleModel.equals("org.eclipse.team.ui.activeModelProvider")))
    {
      ITeamContentProviderDescriptor desc = TeamUI.getTeamContentProviderManager().getDescriptor(visibleModel);
      if ((desc != null) && (desc.isEnabled())) {
        return new String[] { desc.getContentExtensionId() };
      }
    }
    configuration.setProperty("org.eclipse.team.ui.activeModelProvider", "org.eclipse.team.ui.activeModelProvider");
    ModelSynchronizeParticipant participant = (ModelSynchronizeParticipant)configuration.getParticipant();
    ModelProvider[] providers = participant.getEnabledModelProviders();
    Set result = new HashSet();
    Object property = configuration.getProperty("org.eclipse.team.ui.pageLayout");
    boolean isFlatLayout = (property != null) && (property.equals("org.eclipse.team.ui.flatLayout"));
    for (int i = 0; i < providers.length; i++)
    {
      ModelProvider provider = providers[i];
      ITeamContentProviderDescriptor desc = TeamUI.getTeamContentProviderManager().getDescriptor(provider.getId());
      if ((desc != null) && (desc.isEnabled()) && ((!isFlatLayout) || (desc.isFlatLayoutSupported()))) {
        result.add(desc.getContentExtensionId());
      }
    }
    return (String[])result.toArray(new String[result.size()]);
  }
  
  private static void bindTeamContentProviders(CommonViewer v)
  {
    ITeamContentProviderManager teamContentProviderManager = TeamUI.getTeamContentProviderManager();
    ITeamContentProviderDescriptor[] descriptors = teamContentProviderManager.getDescriptors();
    Set toBind = new HashSet();
    for (int i = 0; i < descriptors.length; i++)
    {
      ITeamContentProviderDescriptor descriptor = descriptors[i];
      toBind.add(descriptor.getContentExtensionId());
    }
    v.getNavigatorContentService().bindExtensions((String[])toBind.toArray(new String[toBind.size()]), true);
  }
  
  private static ISynchronizationScope getScope(ISynchronizePageConfiguration configuration)
  {
    return (ISynchronizationScope)configuration.getProperty("org.eclipse.team.ui.synchronizationScope");
  }
  
  public CommonViewerAdvisor(Composite parent, ISynchronizePageConfiguration configuration)
  {
    super(configuration);
    CommonViewer viewer = createViewer(parent, configuration, this);
    TeamUI.getTeamContentProviderManager().addPropertyChangeListener(this);
    configuration.addPropertyChangeListener(this);
    GridData data = new GridData(1808);
    viewer.getControl().setLayoutData(data);
    viewer.getNavigatorContentService().addListener(this);
    initializeViewer(viewer);
    IBaseLabelProvider provider = viewer.getLabelProvider();
    if ((provider instanceof DecoratingLabelProvider))
    {
      DecoratingLabelProvider dlp = (DecoratingLabelProvider)provider;
      ILabelDecorator decorator = ((SynchronizePageConfiguration)configuration).getLabelDecorator();
      if (decorator != null)
      {
        ILabelProvider lp = dlp.getLabelProvider();
        dlp = new DecoratingLabelProvider(
          new DecoratingLabelProvider(lp, decorator), 
          PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
        viewer.setLabelProvider(dlp);
      }
      DecorationContext decorationContext = new DecorationContext();
      decorationContext.putProperty("org.eclipse.team.ui.syncStateTester", new SynchronizationStateTester()
      {
        public boolean isStateDecorationEnabled()
        {
          return false;
        }
      });
      dlp.setDecorationContext(decorationContext);
    }
    else if ((provider instanceof DecoratingStyledCellLabelProvider))
    {
      DecoratingStyledCellLabelProvider dsclp = (DecoratingStyledCellLabelProvider)provider;
      ILabelDecorator decorator = ((SynchronizePageConfiguration)configuration)
        .getLabelDecorator();
      if (decorator != null)
      {
        DelegatingStyledCellLabelProvider.IStyledLabelProvider slp = dsclp.getStyledStringProvider();
        dsclp = new DecoratingStyledCellLabelProvider(
          new MyDecoratingStyledCellLabelProvider(slp, decorator), 
          PlatformUI.getWorkbench().getDecoratorManager()
          .getLabelDecorator(), null);
        viewer.setLabelProvider(dsclp);
      }
      DecorationContext decorationContext = new DecorationContext();
      decorationContext.putProperty("org.eclipse.team.ui.syncStateTester", new SynchronizationStateTester()
      {
        public boolean isStateDecorationEnabled()
        {
          return false;
        }
      });
      dsclp.setDecorationContext(decorationContext);
    }
  }
  
  private class MyDecoratingStyledCellLabelProvider
    extends DecoratingStyledCellLabelProvider
    implements DelegatingStyledCellLabelProvider.IStyledLabelProvider, IFontProvider
  {
    private DelegatingStyledCellLabelProvider.IStyledLabelProvider slp;
    
    public MyDecoratingStyledCellLabelProvider(DelegatingStyledCellLabelProvider.IStyledLabelProvider slp, ILabelDecorator decorator)
    {
      super(decorator, null);
      this.slp = slp;
    }
    
    public StyledString getStyledText(Object element)
    {
      return slp.getStyledText(element);
    }
    
    public Font getFont(Object element)
    {
      return super.getFont(element);
    }
  }
  
  public void setInitialInput()
  {
    CommonViewer viewer = (CommonViewer)getViewer();
    viewer.setInput(getInitialInput());
    viewer.expandToLevel(2);
  }
  
  public void initializeViewer(StructuredViewer viewer)
  {
    createActionService((CommonViewer)viewer, getConfiguration());
    super.initializeViewer(viewer);
  }
  
  private void createActionService(CommonViewer viewer, ISynchronizePageConfiguration configuration)
  {
    ICommonViewerSite commonSite = createCommonViewerSite(viewer, configuration);
    actionService = new NavigatorActionService(commonSite, viewer, viewer.getNavigatorContentService());
  }
  
  private ICommonViewerSite createCommonViewerSite(CommonViewer viewer, ISynchronizePageConfiguration configuration)
  {
    IWorkbenchSite site = configuration.getSite().getWorkbenchSite();
    if ((site instanceof IEditorSite))
    {
      IEditorSite es = (IEditorSite)site;
      return CommonViewerSiteFactory.createCommonViewerSite(es);
    }
    if ((site instanceof IViewSite))
    {
      IViewSite vs = (IViewSite)site;
      return CommonViewerSiteFactory.createCommonViewerSite(vs);
    }
    if ((site instanceof IPageSite))
    {
      IPageSite ps = (IPageSite)site;
      return CommonViewerSiteFactory.createCommonViewerSite(configuration.getViewerId(), ps);
    }
    return CommonViewerSiteFactory.createCommonViewerSite(configuration.getViewerId(), viewer, configuration.getSite().getShell());
  }
  
  private Object getInitialInput()
  {
    String visible = (String)getConfiguration().getProperty("org.eclipse.team.ui.activeModelProvider");
    if ((visible != null) && (!visible.equals("org.eclipse.team.ui.activeModelProvider"))) {
      try
      {
        IModelProviderDescriptor desc = ModelProvider.getModelProviderDescriptor(visible);
        if (desc != null) {
          return desc.getModelProvider();
        }
      }
      catch (CoreException e)
      {
        TeamUIPlugin.log(e);
      }
    }
    return getConfiguration().getProperty("org.eclipse.team.ui.synchronizationContext");
  }
  
  public void onLoad(INavigatorContentExtension anExtension)
  {
    extensions.add(anExtension);
    ISynchronizationContext context = getParticipant().getContext();
    anExtension.getStateModel().setProperty("org.eclipse.team.ui.synchronizationScope", context.getScope());
    anExtension.getStateModel().setProperty("org.eclipse.team.ui.synchronizationPageConfiguration", getConfiguration());
    anExtension.getStateModel().setProperty("org.eclipse.team.ui.synchronizationContext", context);
  }
  
  private ModelSynchronizeParticipant getParticipant()
  {
    return (ModelSynchronizeParticipant)getConfiguration().getParticipant();
  }
  
  protected String getContextMenuId(StructuredViewer viewer)
  {
    return ((CommonViewer)viewer).getNavigatorContentService().getViewerDescriptor().getPopupMenuId();
  }
  
  protected void registerContextMenu(StructuredViewer viewer, MenuManager menuMgr)
  {
    actionService.prepareMenuForPlatformContributions(menuMgr, 
      viewer, false);
  }
  
  protected void fillContextMenu(StructuredViewer viewer, IMenuManager manager)
  {
    if ((manager instanceof CommonMenuManager))
    {
      CommonMenuManager cmm = (CommonMenuManager)manager;
      cmm.clearHandlers();
    }
    ISelection selection = getViewer().getSelection();
    actionService.setContext(new ActionContext(selection));
    actionService.fillContextMenu(manager);
    
    super.fillContextMenu(viewer, manager);
  }
  
  public void dispose()
  {
    TeamUI.getTeamContentProviderManager().removePropertyChangeListener(this);
    getConfiguration().removePropertyChangeListener(this);
    actionService.dispose();
    super.dispose();
  }
  
  protected void updateActionBars(IStructuredSelection selection)
  {
    super.updateActionBars(selection);
    if (!getConfiguration().getSite().isModal())
    {
      actionService.setContext(new ActionContext(selection));
      
      SubActionBars subActionBars = (SubActionBars)getConfiguration().getProperty("org.eclipse.team.ui.actionServiceActionBars");
      if (subActionBars == null)
      {
        subActionBars = new CommonSubActionBars(getConfiguration().getSite().getActionBars());
        getConfiguration().setProperty("org.eclipse.team.ui.actionServiceActionBars", subActionBars);
      }
      actionService.fillActionBars(subActionBars);
    }
  }
  
  protected MenuManager createContextMenuManager(String targetID)
  {
    return new CommonMenuManager(targetID);
  }
  
  protected void addContextMenuGroups(IMenuManager manager) {}
  
  public void addEmptyTreeListener(IEmptyTreeListener emptyTreeListener)
  {
    this.emptyTreeListener = emptyTreeListener;
  }
  
  public void treeEmpty(TreeViewer viewer)
  {
    if (emptyTreeListener != null) {
      emptyTreeListener.treeEmpty(viewer);
    }
  }
  
  public void notEmpty(TreeViewer viewer)
  {
    if (emptyTreeListener != null) {
      emptyTreeListener.notEmpty(viewer);
    }
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    if (event.getProperty().equals("org.eclipse.team.ui.ENABLED_MODEL_PROVIDERS"))
    {
      enableContentProviders((CommonViewer)getViewer(), getConfiguration());
    }
    else if (event.getProperty().equals("org.eclipse.team.ui.activeModelProvider"))
    {
      enableContentProviders((CommonViewer)getViewer(), getConfiguration());
      Viewer viewer = getViewer();
      Utils.syncExec(new Runnable()
      {
        private final PropertyChangeEvent val$event;
        private final Viewer val$viewer;
        
        public void run()
        {
          Object viewerInput = ModelSynchronizePage.getViewerInput(getConfiguration(), (String)val$event.getNewValue());
          if ((val$viewer != null) && (viewerInput != null)) {
            val$viewer.setInput(viewerInput);
          }
        }
      }, (StructuredViewer)viewer);
    }
    else if (event.getProperty().equals("org.eclipse.team.ui.pageLayout"))
    {
      enableContentProviders((CommonViewer)getViewer(), getConfiguration());
    }
  }
  
  protected boolean handleDoubleClick(StructuredViewer viewer, DoubleClickEvent event)
  {
    if (isOpenable(event.getSelection())) {
      return true;
    }
    return super.handleDoubleClick(viewer, event);
  }
  
  private boolean isOpenable(ISelection selection)
  {
    IStructuredSelection ss = (IStructuredSelection)selection;
    Object object = ss.getFirstElement();
    if (object == null) {
      return false;
    }
    return getParticipant().hasCompareInputFor(object);
  }
  
  protected void expandToNextDiff(Object element)
  {
    ((TreeViewer)getViewer()).expandToLevel(element, -1);
  }
}

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

import org.eclipse.compare.structuremergeviewer.ICompareInput;

class CompareInputChangeNotifier$1
  implements Runnable
{
  final CompareInputChangeNotifier this$0;
  private final ICompareInput[] val$inputs;
  
  CompareInputChangeNotifier$1(CompareInputChangeNotifier paramCompareInputChangeNotifier, ICompareInput[] paramArrayOfICompareInput)
  {
    this$0 = paramCompareInputChangeNotifier;val$inputs = paramArrayOfICompareInput;
  }
  
  public void run()
  {
    this$0.fireChanges(val$inputs);
  }
}

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

class CompareInputChangeNotifier$CompareInputConnecton
{
  private int connections;
  final CompareInputChangeNotifier this$0;
  
  private CompareInputChangeNotifier$CompareInputConnecton(CompareInputChangeNotifier paramCompareInputChangeNotifier)
  {
    this$0 = paramCompareInputChangeNotifier;
  }
  
  CompareInputChangeNotifier$CompareInputConnecton(CompareInputChangeNotifier paramCompareInputChangeNotifier, CompareInputConnecton paramCompareInputConnecton)
  {
    this(paramCompareInputChangeNotifier);
  }
  
  public void increment()
  {
    connections += 1;
  }
  
  public void decrement()
  {
    if (connections > 0) {
      connections -= 1;
    }
  }
  
  public boolean isDisconnected()
  {
    return connections == 0;
  }
}

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

import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.team.internal.core.BackgroundEventHandler.Event;

class CompareInputChangeNotifier$InputChangeEvent
  extends BackgroundEventHandler.Event
{
  private final ICompareInput[] inputs;
  
  public CompareInputChangeNotifier$InputChangeEvent(ICompareInput[] inputs)
  {
    super(1);
    this.inputs = inputs;
  }
  
  public ICompareInput[] getChangedInputs()
  {
    return inputs;
  }
}

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

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.core.BackgroundEventHandler;
import org.eclipse.team.internal.core.BackgroundEventHandler.Event;
import org.eclipse.team.internal.core.BackgroundEventHandler.RunnableEvent;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIMessages;

class CompareInputChangeNotifier$InputChangeEventHandler
  extends BackgroundEventHandler
{
  private final Set changedInputs;
  private final List pendingRunnables;
  final CompareInputChangeNotifier this$0;
  
  protected CompareInputChangeNotifier$InputChangeEventHandler(CompareInputChangeNotifier paramCompareInputChangeNotifier)
  {
    super(TeamUIMessages.CompareInputChangeNotifier_0, TeamUIMessages.CompareInputChangeNotifier_1);this$0 = paramCompareInputChangeNotifier;changedInputs = new HashSet();pendingRunnables = new ArrayList();
  }
  
  protected boolean doDispatchEvents(IProgressMonitor monitor)
    throws TeamException
  {
    BackgroundEventHandler.RunnableEvent[] events;
    ICompareInput[] toDispatch;
    synchronized (pendingRunnables)
    {
      synchronized (changedInputs)
      {
        if ((changedInputs.isEmpty()) && (pendingRunnables.isEmpty())) {
          return false;
        }
        ICompareInput[] toDispatch = (ICompareInput[])changedInputs.toArray(new ICompareInput[changedInputs.size()]);
        BackgroundEventHandler.RunnableEvent[] events = (BackgroundEventHandler.RunnableEvent[])pendingRunnables.toArray(new BackgroundEventHandler.RunnableEvent[pendingRunnables.size()]);
        changedInputs.clear();
        pendingRunnables.clear();
      }
    }
    BackgroundEventHandler.RunnableEvent[] events;
    ICompareInput[] toDispatch;
    this$0.dispatchChanges(toDispatch, monitor);
    for (int i = 0; i < events.length; i++)
    {
      BackgroundEventHandler.RunnableEvent event = events[i];
      executeRunnableNow(event, monitor);
    }
    return true;
  }
  
  protected void processEvent(BackgroundEventHandler.Event event, IProgressMonitor monitor)
    throws CoreException
  {
    int type = event.getType();
    switch (type)
    {
    case 1000: 
      BackgroundEventHandler.RunnableEvent runnableEvent = (BackgroundEventHandler.RunnableEvent)event;
      if (runnableEvent.isPreemtive()) {
        executeRunnableNow(event, monitor);
      } else {
        executeRunnableDuringDispatch(event);
      }
      
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