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

   if ((modelObject instanceof IAdaptable))
      {
        workbenchAdapter = ResourceMappingResourceDisplayArea.access$1((IAdaptable)modelObject);
        o = modelObject;
      }
    }
    if (workbenchAdapter == null) {
      return null;
    }
    return workbenchAdapter.getImageDescriptor(o);
  }
  
  public String getLabel(Object o)
  {
    return ResourceMappingResourceDisplayArea.getLabel(mapping);
  }
  
  public Object getParent(Object o)
  {
    return null;
  }
  
  public Object getAdapter(Class adapter)
  {
    Class tmp4_1 = ResourceMappingResourceDisplayArea.class$0;
    if (tmp4_1 == null)
    {
      tmp4_1;
      try
      {
        tmpTernaryOp = (ResourceMappingResourceDisplayArea.class$0 = Class.forName("org.eclipse.ui.model.IWorkbenchAdapter"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    if (adapter == tmp4_1) {
      return this;
    }
    return null;
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.model.IWorkbenchAdapter;

public class ResourceMappingResourceDisplayArea$ResourceTraversalElement
  implements IWorkbenchAdapter, IAdaptable
{
  private ResourceTraversal traversal;
  private ResourceMappingContext context;
  private IResource resource;
  private Object parent;
  final ResourceMappingResourceDisplayArea this$0;
  
  public ResourceMappingResourceDisplayArea$ResourceTraversalElement(ResourceMappingResourceDisplayArea paramResourceMappingResourceDisplayArea, Object parent, ResourceTraversal traversal, IResource resource, ResourceMappingContext context)
  {
    this$0 = paramResourceMappingResourceDisplayArea;
    this.parent = parent;
    this.traversal = traversal;
    this.resource = resource;
    this.context = context;
  }
  
  public Object[] getChildren(Object o)
  {
    if (traversal.getDepth() == 2) {
      return getChildren(true);
    }
    if ((traversal.getDepth() == 1) && (isTraversalRoot(resource))) {
      return getChildren(false);
    }
    return new Object[0];
  }
  
  private Object[] getChildren(boolean includeFolders)
  {
    try
    {
      if (resource.getType() != 1)
      {
        IResource[] members = members((IContainer)resource);
        List result = new ArrayList();
        for (int i = 0; i < members.length; i++)
        {
          IResource child = members[i];
          if (((includeFolders) || (child.getType() == 1)) && 
            (ResourceMappingResourceDisplayArea.access$0(this$0, child, traversal))) {
            result.add(new ResourceTraversalElement(this$0, this, traversal, child, context));
          }
        }
        return result.toArray(new Object[result.size()]);
      }
    }
    catch (CoreException e)
    {
      TeamUIPlugin.log(4, "An error occurred fetching the members of " + resource.getFullPath(), e);
    }
    return new Object[0];
  }
  
  private IResource[] members(IContainer container)
    throws CoreException
  {
    if ((context instanceof RemoteResourceMappingContext))
    {
      RemoteResourceMappingContext remoteContext = (RemoteResourceMappingContext)context;
      return ResourceMappingResourceDisplayArea.members(container, remoteContext);
    }
    return container.members();
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    IWorkbenchAdapter workbenchAdapter = ResourceMappingResourceDisplayArea.access$1(resource);
    if (workbenchAdapter == null) {
      return null;
    }
    return workbenchAdapter.getImageDescriptor(resource);
  }
  
  public String getLabel(Object o)
  {
    if ((resource.getType() != 4) && (isTraversalRoot(resource))) {
      return resource.getFullPath().toString();
    }
    IWorkbenchAdapter workbenchAdapter = ResourceMappingResourceDisplayArea.access$1(resource);
    if (workbenchAdapter == null) {
      return resource.getName();
    }
    return workbenchAdapter.getLabel(resource);
  }
  
  private boolean isTraversalRoot(IResource resource)
  {
    return ResourceMappingResourceDisplayArea.isTraversalRoot(traversal, resource);
  }
  
  public Object getParent(Object o)
  {
    return parent;
  }
  
  public Object getAdapter(Class adapter)
  {
    Class tmp4_1 = ResourceMappingResourceDisplayArea.class$0;
    if (tmp4_1 == null)
    {
      tmp4_1;
      try
      {
        tmpTernaryOp = (ResourceMappingResourceDisplayArea.class$0 = Class.forName("org.eclipse.ui.model.IWorkbenchAdapter"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    if (adapter == tmp4_1) {
      return this;
    }
    return null;
  }
  
  public IResource getResource()
  {
    return resource;
  }
}

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

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.mapping.RemoteResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.resources.mapping.ResourceMappingContext;
import org.eclipse.core.resources.mapping.ResourceTraversal;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.views.navigator.ResourceComparator;

public class ResourceMappingResourceDisplayArea
  extends DialogArea
{
  private ResourceMapping mapping;
  private ResourceMappingContext context = ResourceMappingContext.LOCAL_CONTEXT;
  private TreeViewer viewer;
  private Label label;
  private IResourceMappingResourceFilter filter;
  private Map cachedFiltering = new HashMap();
  private String message;
  
  private static IWorkbenchAdapter getWorkbenchAdapter(IAdaptable o)
  {
    return (IWorkbenchAdapter)o.getAdapter(IWorkbenchAdapter.class);
  }
  
  public static String getLabel(ResourceMapping mapping)
  {
    Object o = mapping;
    IWorkbenchAdapter workbenchAdapter = getWorkbenchAdapter((IAdaptable)o);
    if (workbenchAdapter == null)
    {
      Object modelObject = mapping.getModelObject();
      if ((modelObject instanceof IAdaptable))
      {
        workbenchAdapter = getWorkbenchAdapter((IAdaptable)modelObject);
        o = modelObject;
      }
    }
    if (workbenchAdapter == null) {
      return mapping.toString();
    }
    return workbenchAdapter.getLabel(o);
  }
  
  public class ResourceMappingElement
    implements IWorkbenchAdapter, IAdaptable
  {
    private ResourceMapping mapping;
    private ResourceMappingContext context;
    
    public ResourceMappingElement(ResourceMapping mapping, ResourceMappingContext context)
    {
      this.mapping = mapping;
      this.context = context;
    }
    
    public Object[] getChildren(Object o)
    {
      ResourceTraversal[] traversals = getTraversals();
      List result = new ArrayList();
      for (int i = 0; i < traversals.length; i++)
      {
        ResourceTraversal traversal = traversals[i];
        IResource[] resources = traversal.getResources();
        for (int j = 0; j < resources.length; j++)
        {
          IResource resource = resources[j];
          if (ResourceMappingResourceDisplayArea.this.isIncludedInFilter(resource, traversal)) {
            result.add(new ResourceMappingResourceDisplayArea.ResourceTraversalElement(ResourceMappingResourceDisplayArea.this, this, traversal, resource, context));
          }
        }
      }
      return result.toArray(new Object[result.size()]);
    }
    
    private ResourceTraversal[] getTraversals()
    {
      return ResourceMappingResourceDisplayArea.getTraversals(mapping, context);
    }
    
    public ImageDescriptor getImageDescriptor(Object o)
    {
      o = mapping;
      IWorkbenchAdapter workbenchAdapter = ResourceMappingResourceDisplayArea.getWorkbenchAdapter((IAdaptable)o);
      if (workbenchAdapter == null)
      {
        Object modelObject = mapping.getModelObject();
        if ((modelObject instanceof IAdaptable))
        {
          workbenchAdapter = ResourceMappingResourceDisplayArea.getWorkbenchAdapter((IAdaptable)modelObject);
          o = modelObject;
        }
      }
      if (workbenchAdapter == null) {
        return null;
      }
      return workbenchAdapter.getImageDescriptor(o);
    }
    
    public String getLabel(Object o)
    {
      return ResourceMappingResourceDisplayArea.getLabel(mapping);
    }
    
    public Object getParent(Object o)
    {
      return null;
    }
    
    public Object getAdapter(Class adapter)
    {
      Class tmp4_1 = ResourceMappingResourceDisplayArea.class$0;
      if (tmp4_1 == null)
      {
        tmp4_1;
        try
        {
          tmpTernaryOp = (ResourceMappingResourceDisplayArea.class$0 = Class.forName("org.eclipse.ui.model.IWorkbenchAdapter"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      if (adapter == tmp4_1) {
        return this;
      }
      return null;
    }
  }
  
  public class ResourceTraversalElement
    implements IWorkbenchAdapter, IAdaptable
  {
    private ResourceTraversal traversal;
    private ResourceMappingContext context;
    private IResource resource;
    private Object parent;
    
    public ResourceTraversalElement(Object parent, ResourceTraversal traversal, IResource resource, ResourceMappingContext context)
    {
      this.parent = parent;
      this.traversal = traversal;
      this.resource = resource;
      this.context = context;
    }
    
    public Object[] getChildren(Object o)
    {
      if (traversal.getDepth() == 2) {
        return getChildren(true);
      }
      if ((traversal.getDepth() == 1) && (isTraversalRoot(resource))) {
        return getChildren(false);
      }
      return new Object[0];
    }
    
    private Object[] getChildren(boolean includeFolders)
    {
      try
      {
        if (resource.getType() != 1)
        {
          IResource[] members = members((IContainer)resource);
          List result = new ArrayList();
          for (int i = 0; i < members.length; i++)
          {
            IResource child = members[i];
            if (((includeFolders) || (child.getType() == 1)) && 
              (ResourceMappingResourceDisplayArea.this.isIncludedInFilter(child, traversal))) {
              result.add(new ResourceTraversalElement(ResourceMappingResourceDisplayArea.this, this, traversal, child, context));
            }
          }
          return result.toArray(new Object[result.size()]);
        }
      }
      catch (CoreException e)
      {
        TeamUIPlugin.log(4, "An error occurred fetching the members of " + resource.getFullPath(), e);
      }
      return new Object[0];
    }
    
    private IResource[] members(IContainer container)
      throws CoreException
    {
      if ((context instanceof RemoteResourceMappingContext))
      {
        RemoteResourceMappingContext remoteContext = (RemoteResourceMappingContext)context;
        return ResourceMappingResourceDisplayArea.members(container, remoteContext);
      }
      return container.members();
    }
    
    public ImageDescriptor getImageDescriptor(Object object)
    {
      IWorkbenchAdapter workbenchAdapter = ResourceMappingResourceDisplayArea.getWorkbenchAdapter(resource);
      if (workbenchAdapter == null) {
        return null;
      }
      return workbenchAdapter.getImageDescriptor(resource);
    }
    
    public String getLabel(Object o)
    {
      if ((resource.getType() != 4) && (isTraversalRoot(resource))) {
        return resource.getFullPath().toString();
      }
      IWorkbenchAdapter workbenchAdapter = ResourceMappingResourceDisplayArea.getWorkbenchAdapter(resource);
      if (workbenchAdapter == null) {
        return resource.getName();
      }
      return workbenchAdapter.getLabel(resource);
    }
    
    private boolean isTraversalRoot(IResource resource)
    {
      return ResourceMappingResourceDisplayArea.isTraversalRoot(traversal, resource);
    }
    
    public Object getParent(Object o)
    {
      return parent;
    }
    
    public Object getAdapter(Class adapter)
    {
      Class tmp4_1 = ResourceMappingResourceDisplayArea.class$0;
      if (tmp4_1 == null)
      {
        tmp4_1;
        try
        {
          tmpTernaryOp = (ResourceMappingResourceDisplayArea.class$0 = Class.forName("org.eclipse.ui.model.IWorkbenchAdapter"));
        }
        catch (ClassNotFoundException localClassNotFoundException)
        {
          throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
        }
      }
      if (adapter == tmp4_1) {
        return this;
      }
      return null;
    }
    
    public IResource getResource()
    {
      return resource;
    }
  }
  
  public ResourceMappingResourceDisplayArea(ResourceMapping mapping, String string, IResourceMappingResourceFilter filter)
  {
    this.mapping = mapping;
    this.filter = filter;
    message = string;
  }
  
  public void createArea(Composite parent)
  {
    Composite composite = createComposite(parent, 1, true);
    
    label = createWrappingLabel(composite, message, 1);
    viewer = new TreeViewer(composite);
    GridData gridData = new GridData(1808);
    heightHint = 100;
    viewer.getControl().setLayoutData(gridData);
    viewer.setContentProvider(new WorkbenchContentProvider());
    viewer.setLabelProvider(new WorkbenchLabelProvider());
    viewer.setComparator(new ResourceComparator(1)
    {
      public int compare(Viewer viewer, Object o1, Object o2)
      {
        if (((o1 instanceof ResourceMappingResourceDisplayArea.ResourceTraversalElement)) && ((o2 instanceof ResourceMappingResourceDisplayArea.ResourceTraversalElement)))
        {
          ResourceMappingResourceDisplayArea.ResourceTraversalElement e1 = (ResourceMappingResourceDisplayArea.ResourceTraversalElement)o1;
          ResourceMappingResourceDisplayArea.ResourceTraversalElement e2 = (ResourceMappingResourceDisplayArea.ResourceTraversalElement)o2;
          return super.compare(viewer, e1.getResource(), e2.getResource());
        }
        return super.compare(viewer, o1, o2);
      }
    });
    setInput(message);
    Dialog.applyDialogFont(parent);
  }
  
  private void setInput(String labelText)
  {
    if (viewer != null)
    {
      Object o = null;
      if (mapping != null) {
        o = new ResourceMappingElement(mapping, context);
      }
      viewer.setInput(o);
    }
    if (label != null)
    {
      message = labelText;
      label.setText(labelText);
    }
  }
  
  public void setMapping(ResourceMapping mapping, String labelText)
  {
    this.mapping = mapping;
    setInput(labelText);
  }
  
  private boolean isIncludedInFilter(IResource resource, ResourceTraversal traversal)
  {
    if (filter == null) {
      return true;
    }
    Map mappingResources = (Map)cachedFiltering.get(mapping);
    if (mappingResources == null)
    {
      mappingResources = buildFilteredResourceMap(mapping, context);
      cachedFiltering.put(mapping, mappingResources);
    }
    return mappingResources.containsKey(resource);
  }
  
  private Map buildFilteredResourceMap(ResourceMapping mapping, ResourceMappingContext context)
  {
    Map result = new HashMap();
    try
    {
      PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress()
      {
        private final ResourceMapping val$mapping;
        private final ResourceMappingContext val$context;
        private final Map val$result;
        
        /* Error */
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          // Byte code:
          //   0: aload_1
          //   1: aconst_null
          //   2: iconst_m1
          //   3: invokeinterface 91 3 0
          //   8: aload_0
          //   9: getfield 80	org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea$2:val$mapping	Lorg/eclipse/core/resources/mapping/ResourceMapping;
          //   12: aload_0
          //   13: getfield 81	org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea$2:val$context	Lorg/eclipse/core/resources/mapping/ResourceMappingContext;
          //   16: aload_1
          //   17: iconst_m1
          //   18: invokestatic 87	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
          //   21: invokevirtual 85	org/eclipse/core/resources/mapping/ResourceMapping:getTraversals	(Lorg/eclipse/core/resources/mapping/ResourceMappingContext;Lorg/eclipse/core/runtime/IProgressMonitor;)[Lorg/eclipse/core/resources/mapping/ResourceTraversal;
          //   24: astore_2
          //   25: iconst_0
          //   26: istore_3
          //   27: goto +30 -> 57
          //   30: aload_2
          //   31: iload_3
          //   32: aaload
          //   33: astore 4
          //   35: aload_0
          //   36: aload_0
          //   37: getfield 80	org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea$2:val$mapping	Lorg/eclipse/core/resources/mapping/ResourceMapping;
          //   40: aload 4
          //   42: aload_1
          //   43: iconst_m1
          //   44: invokestatic 87	org/eclipse/team/internal/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
          //   47: aload_0
          //   48: getfield 79	org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea$2:val$result	Ljava/util/Map;
          //   51: invokespecial 88	org/eclipse/team/internal/ui/dialogs/ResourceMappingResourceDisplayArea$2:buildFilteredResourceMap	(Lorg/eclipse/core/resources/mapping/ResourceMapping;Lorg/eclipse/core/resources/mapping/ResourceTraversal;Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/util/Map;)V
          //   54: iinc 3 1
          //   57: iload_3
          //   58: aload_2
          //   59: arraylength
          //   60: if_icmplt -30 -> 30
          //   63: goto +24 -> 87
          //   66: astore_2
          //   67: new 39	java/lang/reflect/InvocationTargetException
          //   70: dup
          //   71: aload_2
          //   72: invokespecial 84	java/lang/reflect/InvocationTargetException:<init>	(Ljava/lang/Throwable;)V
          //   75: athrow
          //   76: astore 5
          //   78: aload_1
          //   79: invokeinterface 90 1 0
          //   84: aload 5
          //   86: athrow
          //   87: aload_1
          //   88: invokeinterface 90 1 0
          //   93: return
          // Line number table:
          //   Java source line #323	-> byte code offset #0
          //   Java source line #324	-> byte code offset #8
          //   Java source line #325	-> byte code offset #25
          //   Java source line #326	-> byte code offset #30
          //   Java source line #327	-> byte code offset #35
          //   Java source line #325	-> byte code offset #54
          //   Java source line #329	-> byte code offset #66
          //   Java source line #330	-> byte code offset #67
          //   Java source line #331	-> byte code offset #76
          //   Java source line #332	-> byte code offset #78
          //   Java source line #333	-> byte code offset #84
          //   Java source line #332	-> byte code offset #87
          //   Java source line #334	-> byte code offset #93
          // Local variable table:
          //   start	length	slot	name	signature
          //   0	94	0	this	2
          //   0	94	1	monitor	IProgressMonitor
          //   24	35	2	traversals	ResourceTraversal[]
          //   66	6	2	e	CoreException
          //   26	32	3	i	int
          //   33	8	4	traversal	ResourceTraversal
          //   76	9	5	localObject	Object
          // Exception table:
          //   from	to	target	type
          //   0	63	66	org/eclipse/core/runtime/CoreException
          //   0	76	76	finally
        }
        
        private void buildFilteredResourceMap(ResourceMapping mapping, ResourceTraversal traversal, IProgressMonitor monitor, Map result)
          throws CoreException
        {
          traversal.accept(new ResourceMappingResourceDisplayArea.3(this, mapping, traversal, result));
        }
      });
    }
    catch (InvocationTargetException e)
    {
      TeamUIPlugin.log(4, "An error occurred while filtering " + getLabel(mapping), e);
    }
    catch (InterruptedException localInterruptedException) {}
    return result;
  }
  
  static ResourceTraversal[] getTraversals(ResourceMapping mapping, ResourceMappingContext context)
  {
    List traversals = new ArrayList();
    try
    {
      PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress()
      {
        private final ResourceMapping val$mapping;
        private final ResourceMappingContext val$context;
        
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          try
          {
            add(val$mapping.getTraversals(val$context, monitor));
          }
          catch (CoreException e)
          {
            throw new InvocationTargetException(e);
          }
        }
      });
      return (ResourceTraversal[])traversals.get(0);
    }
    catch (InvocationTargetException e)
    {
      TeamUIPlugin.log(4, "An error occurred while traversing " + getLabel(mapping), e);
    }
    catch (InterruptedException localInterruptedException) {}
    return new ResourceTraversal[0];
  }
  
  static IResource[] members(IContainer container, RemoteResourceMappingContext context)
  {
    List members = new ArrayList();
    try
    {
      PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress()
      {
        private final RemoteResourceMappingContext val$context;
        private final IContainer val$container;
        
        public void run(IProgressMonitor monitor)
          throws InvocationTargetException, InterruptedException
        {
          try
          {
            add(val$context.fetchMembers(val$container, monitor));
          }
          catch (CoreException e)
          {
            throw new InvocationTargetException(e);
          }
        }
      });
      return (IResource[])members.get(0);
    }
    catch (InvocationTargetException e)
    {
      TeamUIPlugin.log(4, "An error occurred while fetching the members of" + container.getFullPath(), e);
    }
    catch (InterruptedException localInterruptedException) {}
    return new IResource[0];
  }
  
  static boolean isTraversalRoot(ResourceTraversal traversal, IResource resource)
  {
    IResource[] resources = traversal.getResources();
    for (int i = 0; i < resources.length; i++)
    {
      IResource root = resources[i];
      if (root.equals(resource)) {
        return true;
      }
    }
    return false;
  }
}

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

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class ResourceMappingSelectionArea$1
  implements ISelectionChangedListener
{
  final ResourceMappingSelectionArea this$0;
  
  ResourceMappingSelectionArea$1(ResourceMappingSelectionArea paramResourceMappingSelectionArea)
  {
    this$0 = paramResourceMappingSelectionArea;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    ResourceMapping oldSelection = ResourceMappingSelectionArea.access$0(this$0);
    ResourceMappingSelectionArea.access$1(this$0, this$0.internalGetSelectedMapping());
    if (oldSelection != ResourceMappingSelectionArea.access$0(this$0)) {
      this$0.firePropertyChangeChange("SelectedMapping", oldSelection, ResourceMappingSelectionArea.access$0(this$0));
    }
  }
}

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

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.ICheckStateListener;

class ResourceMappingSelectionArea$2
  implements ICheckStateListener
{
  final ResourceMappingSelectionArea this$0;
  
  ResourceMappingSelectionArea$2(ResourceMappingSelectionArea paramResourceMappingSelectionArea)
  {
    this$0 = paramResourceMappingSelectionArea;
  }
  
  public void checkStateChanged(CheckStateChangedEvent event)
  {
    ResourceMapping[] oldMappings = ResourceMappingSelectionArea.access$2(this$0);
    ResourceMappingSelectionArea.access$3(this$0, this$0.internalGetCheckedMappings());
    if (oldMappings != ResourceMappingSelectionArea.access$2(this$0)) {
      this$0.firePropertyChangeChange("CheckedMappings", oldMappings, ResourceMappingSelectionArea.access$2(this$0));
    }
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ResourceMappingSelectionArea$3
  extends SelectionAdapter
{
  final ResourceMappingSelectionArea this$0;
  private final CheckboxTableViewer val$checkboxViewer;
  
  ResourceMappingSelectionArea$3(ResourceMappingSelectionArea paramResourceMappingSelectionArea, CheckboxTableViewer paramCheckboxTableViewer)
  {
    this$0 = paramResourceMappingSelectionArea;val$checkboxViewer = paramCheckboxTableViewer;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    val$checkboxViewer.setAllChecked(true);
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class ResourceMappingSelectionArea$4
  extends SelectionAdapter
{
  final ResourceMappingSelectionArea this$0;
  private final CheckboxTableViewer val$checkboxViewer;
  
  ResourceMappingSelectionArea$4(ResourceMappingSelectionArea paramResourceMappingSelectionArea, CheckboxTableViewer paramCheckboxTableViewer)
  {
    this$0 = paramResourceMappingSelectionArea;val$checkboxViewer = paramCheckboxTableViewer;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    val$checkboxViewer.setAllChecked(false);
  }
}

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

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
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.Control;
import org.eclipse.swt.widgets.Table;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.mapping.ResourceMappingLabelProvider;
import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;

public class ResourceMappingSelectionArea
  extends DialogArea
{
  public static final String SELECTED_MAPPING = "SelectedMapping";
  public static final String CHECKED_MAPPINGS = "CheckedMappings";
  private ResourceMapping[] mappings;
  private TableViewer viewer;
  private ResourceMapping[] checkedMappings;
  private ResourceMapping selectedMapping;
  private String description;
  private boolean supportsChecking;
  private boolean supportsSelection;
  
  public ResourceMappingSelectionArea(ResourceMapping[] mappings, boolean supportSelection, boolean supportChecking)
  {
    this.mappings = mappings;
    supportsChecking = supportChecking;
    supportsSelection = supportSelection;
  }
  
  public void createArea(Composite parent)
  {
    Composite composite = createComposite(parent, 1, true);
    GridLayout layout = new GridLayout(1, false);
    marginHeight = 0;
    marginWidth = 0;
    verticalSpacing = 0;
    horizontalSpacing = 0;
    composite.setLayout(layout);
    if (description != null) {
      createWrappingLabel(composite, description, 1);
    }
    createViewer(composite);
    GridData data = new GridData(1808);
    heightHint = 100;
    widthHint = 300;
    viewer.getControl().setLayoutData(data);
    viewer.setContentProvider(new BaseWorkbenchContentProvider());
    viewer.setLabelProvider(new ResourceMappingLabelProvider());
    viewer.setInput(new AdaptableList(mappings));
    if (isSupportsSelection()) {
      viewer.addSelectionChangedListener(new ISelectionChangedListener()
      {
        public void selectionChanged(SelectionChangedEvent event)
        {
          ResourceMapping oldSelection = selectedMapping;
          selectedMapping = internalGetSelectedMapping();
          if (oldSelection != selectedMapping) {
            firePropertyChangeChange("SelectedMapping", oldSelection, selectedMapping);
          }
        }
      });
    }
    if (isSupportsChecking()) {
      initializeCheckboxViewer(composite);
    }
  }
  
  private void initializeCheckboxViewer(Composite composite)
  {
    CheckboxTableViewer checkboxViewer = getCheckboxTableViewer();
    checkboxViewer.addCheckStateListener(new ICheckStateListener()
    {
      public void checkStateChanged(CheckStateChangedEvent event)
      {
        ResourceMapping[] oldMappings = checkedMappings;
        checkedMappings = internalGetCheckedMappings();
        if (oldMappings != checkedMappings) {
          firePropertyChangeChange("CheckedMappings", oldMappings, checkedMappings);
        }
      }
    });
    checkboxViewer.setCheckedElements(mappings);
    checkedMappings = mappings;
    
    Composite buttons = createEmbeddedButtonComposite(composite);
    
    Button selectAll = new Button(buttons, 8);
    selectAll.setText(TeamUIMessages.ResourceMappingSelectionArea_0);
    selectAll.setLayoutData(new GridData(1808));
    selectAll.addSelectionListener(new SelectionAdapter()
    {
      private final CheckboxTableViewer val$checkboxViewer;
      
      public void widgetSelected(SelectionEvent e)
      {
        val$checkboxViewer.setAllChecked(true);
      }
    });
    Button deselectAll = new Button(buttons, 8);
    deselectAll.setText(TeamUIMessages.ResourceMappingSelectionArea_1);
    deselectAll.setLayoutData(new GridData(1808));
    deselectAll.addSelectionListener(new SelectionAdapter()
    {
      private final CheckboxTableViewer val$checkboxViewer;
      
      public void widgetSelected(SelectionEvent e)
      {
        val$checkboxViewer.setAllChecked(false);
      }
    });
  }
  
  private void createViewer(Composite composite)
  {
    if (isSupportsChecking()) {
      viewer = CheckboxTableViewer.newCheckList(composite, getViewerStyle());
    } else {
      viewer = new TableViewer(new Table(composite, getViewerStyle()));
    }
  }
  
  private int getViewerStyle()
  {
    int style = 2048;
    if (isSupportsSelection()) {
      style |= 0x4;
    }
    return style;
  }
  
  ResourceMapping[] internalGetCheckedMappings()
  {
    Object[] checked = getCheckboxTableViewer().getCheckedElements();
    ResourceMapping[] mappings = new ResourceMapping[checked.length];
    for (int i = 0; i < checked.length; i++)
    {
      Object object = checked[i];
      mappings[i] = ((ResourceMapping)object);
    }
    return mappings;
  }
  
  private Composite createEmbeddedButtonComposite(Composite composite)
  {
    Composite buttons = new Composite(composite, 0);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    makeColumnsEqualWidth = true;
    marginWidth = 0;
    buttons.setLayout(layout);
    GridData data = new GridData(132);
    
    buttons.setLayoutData(data);
    return buttons;
  }
  
  ResourceMapping internalGetSelectedMapping()
  {
    ISelection selection = viewer.getSelection();
    if ((selection instanceof IStructuredSelection))
    {
      IStructuredSelection ss = (IStructuredSelection)selection;
      Object firstElement = ss.getFirstElement();
      if ((firstElement instanceof ResourceMapping)) {
        return (ResourceMapping)firstElement;
      }
    }
    return null;
  }
  
  public void setDescription(String description)
  {
    this.description = description;
  }
  
  public ResourceMapping[] getCheckedMappings()
  {
    return checkedMappings;
  }
  
  public ResourceMapping getSelectedMapping()
  {
    return selectedMapping;
  }
  
  private CheckboxTableViewer getCheckboxTableViewer()
  {
    return (CheckboxTableViewer)viewer;
  }
  
  public boolean isSupportsChecking()
  {
    return supportsChecking;
  }
  
  public boolean isSupportsSelection()
  {
    return supportsSelection;
  }
}

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

import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.history.IFileRevision;

public abstract class AbstractHistoryCategory
{
  public abstract String getName();
  
  public Image getImage()
  {
    return null;
  }
  
  public abstract boolean hasRevisions();
  
  public abstract boolean collectFileRevisions(IFileRevision[] paramArrayOfIFileRevision, boolean paramBoolean);
  
  public abstract IFileRevision[] getRevisions();
}

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

import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier;

class CompareFileRevisionEditorInput$1
  extends CompareInputChangeNotifier
{
  final CompareFileRevisionEditorInput this$0;
  
  CompareFileRevisionEditorInput$1(CompareFileRevisionEditorInput paramCompareFileRevisionEditorInput)
  {
    this$0 = paramCompareFileRevisionEditorInput;
  }
  
  protected IResource[] getResources(ICompareInput input)
  {
    IResource resource = CompareFileRevisionEditorInput.access$0(this$0, input);
    if (resource == null) {
      return new IResource[0];
    }
    return new IResource[] { resource };
  }
}

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

import org.eclipse.compare.ITypedElement;
import org.eclipse.team.internal.ui.mapping.AbstractCompareInput;
import org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier;

public class CompareFileRevisionEditorInput$MyDiffNode
  extends AbstractCompareInput
{
  final CompareFileRevisionEditorInput this$0;
  
  public CompareFileRevisionEditorInput$MyDiffNode(CompareFileRevisionEditorInput paramCompareFileRevisionEditorInput, ITypedElement left, ITypedElement right)
  {
    super(3, null, left, right);
    this$0 = paramCompareFileRevisionEditorInput;
  }
  
  public void fireChange()
  {
    super.fireChange();
  }
  
  protected CompareInputChangeNotifier getChangeNotifier()
  {
    return this$0.notifier;
  }
  
  public boolean needsUpdate()
  {
    return false;
  }
  
  public void update()
  {
    fireChange();
  }
}

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

import java.lang.reflect.InvocationTargetException;
import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.IEditableContent;
import org.eclipse.compare.IResourceProvider;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileState;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.osgi.util.TextProcessor;
import org.eclipse.team.internal.core.history.LocalFileRevision;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.mapping.AbstractCompareInput;
import org.eclipse.team.internal.ui.mapping.CompareInputChangeNotifier;
import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;
import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput;
import org.eclipse.ui.IWorkbenchPag
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