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

    
    setControl(composite);
    
    initializeDialogUnits(parent);
    
    messageLabel = new Label(composite, 0);
    messageLabel
      .setText(TeamUIMessages.PatchParsedPage_clickFinishToGoToSynchronizeView);
    setPageComplete(true);
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.compare.internal.patch.HunkDiffNode;
import org.eclipse.compare.internal.patch.PatchDiffNode;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IResource;
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.NullProgressMonitor;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.core.mapping.ISynchronizationScope;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.mapping.SynchronizationResourceMappingContext;
import org.eclipse.team.ui.mapping.SynchronizationContentProvider;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;

public class PatchSyncContentProvider
  extends SynchronizationContentProvider
{
  private BaseWorkbenchContentProvider delegate;
  
  public void init(ICommonContentExtensionSite site)
  {
    super.init(site);
    delegate = new BaseWorkbenchContentProvider();
  }
  
  public void dispose()
  {
    super.dispose();
    if (delegate != null) {
      delegate.dispose();
    }
  }
  
  protected ITreeContentProvider getDelegateContentProvider()
  {
    return delegate;
  }
  
  protected String getModelProviderId()
  {
    return "org.eclipse.team.ui.patchModelProvider";
  }
  
  protected Object getModelRoot()
  {
    if ((getContext() instanceof ApplyPatchSubscriberMergeContext))
    {
      ApplyPatchSubscriberMergeContext context = (ApplyPatchSubscriberMergeContext)getContext();
      return PatchModelProvider.getPatchWorkspace(context.getSubscriber());
    }
    return null;
  }
  
  protected ResourceTraversal[] getTraversals(ISynchronizationContext context, Object object)
  {
    if ((object instanceof IDiffElement))
    {
      ResourceMapping mapping = PatchModelProvider.getResourceMapping((IDiffElement)object);
      ResourceMappingContext rmc = new SynchronizationResourceMappingContext(
        context);
      try
      {
        return mapping.getTraversals(rmc, new NullProgressMonitor());
      }
      catch (CoreException e)
      {
        TeamUIPlugin.log(e);
      }
    }
    return new ResourceTraversal[0];
  }
  
  protected boolean isInScope(ISynchronizationScope scope, Object parent, Object element)
  {
    if ((element instanceof PatchDiffNode))
    {
      IResource resource = 
        PatchModelProvider.getResource((PatchDiffNode)element);
      if (resource == null) {
        return false;
      }
      if (scope.contains(resource)) {
        return true;
      }
    }
    return false;
  }
  
  public boolean hasChildren(Object element)
  {
    if ((element instanceof HunkDiffNode)) {
      return false;
    }
    return super.hasChildren(element);
  }
  
  public Object[] getChildren(Object parent)
  {
    Object[] children = super.getChildren(parent);
    List result = new ArrayList();
    for (int i = 0; i < children.length; i++) {
      if ((children[i] instanceof PatchDiffNode))
      {
        PatchDiffNode node = (PatchDiffNode)children[i];
        if (node.isEnabled()) {
          result.add(node);
        }
      }
    }
    return result.toArray();
  }
}

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

import org.eclipse.compare.internal.patch.PatchDiffNode;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.mapping.IResourceDiffTree;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.ui.mapping.SynchronizationLabelProvider;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;

public class PatchSyncLabelProvider
  extends SynchronizationLabelProvider
{
  private PatchWorkbenchLabelProvider delegate;
  
  public void init(ICommonContentExtensionSite site)
  {
    super.init(site);
    delegate = new PatchWorkbenchLabelProvider();
  }
  
  public void dispose()
  {
    super.dispose();
    if (delegate != null) {
      delegate.dispose();
    }
  }
  
  protected ILabelProvider getDelegateLabelProvider()
  {
    return delegate;
  }
  
  protected IDiff getDiff(Object element)
  {
    if ((element instanceof PatchDiffNode))
    {
      IResource resource = 
        PatchModelProvider.getResource((PatchDiffNode)element);
      return getContext().getDiffTree().getDiff(resource);
    }
    return super.getDiff(element);
  }
  
  protected Image getCompareImage(Image base, int kind)
  {
    switch (kind & 0xC)
    {
    case 4: 
      kind = kind & 0xFFFFFFFB | 0x8;
      break;
    case 8: 
      kind = kind & 0xFFFFFFF7 | 0x4;
    }
    return super.getCompareImage(base, kind);
  }
}

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

import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.model.IWorkbenchAdapter;

public class PatchWorkbenchAdapter
  implements IWorkbenchAdapter
{
  public Object[] getChildren(Object o)
  {
    if ((o instanceof DiffNode)) {
      return ((DiffNode)o).getChildren();
    }
    return null;
  }
  
  public ImageDescriptor getImageDescriptor(Object object)
  {
    if ((object instanceof DiffNode))
    {
      Image image = ((DiffNode)object).getImage();
      return ImageDescriptor.createFromImage(image);
    }
    return null;
  }
  
  public String getLabel(Object o)
  {
    if ((o instanceof DiffNode)) {
      return ((DiffNode)o).getName();
    }
    return null;
  }
  
  public Object getParent(Object o)
  {
    if ((o instanceof DiffNode)) {
      return ((DiffNode)o).getParent();
    }
    return null;
  }
}

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

import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.navigator.ICommonContentExtensionSite;
import org.eclipse.ui.navigator.ICommonLabelProvider;

public class PatchWorkbenchLabelProvider
  extends WorkbenchLabelProvider
  implements ICommonLabelProvider
{
  private ICommonContentExtensionSite extensionSite;
  
  public void init(ICommonContentExtensionSite aConfig)
  {
    extensionSite = aConfig;
  }
  
  public void restoreState(IMemento aMemento) {}
  
  public void saveState(IMemento aMemento) {}
  
  public String getDescription(Object anElement)
  {
    if ((anElement instanceof DiffNode)) {
      return ((DiffNode)anElement).getName();
    }
    return null;
  }
  
  public ICommonContentExtensionSite getExtensionSite()
  {
    return extensionSite;
  }
}

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

import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;

class PatchWorkspace$1
  extends LocalResourceTypedElement
{
  private final FileDiffResult val$result;
  
  PatchWorkspace$1(IResource $anonymous0, FileDiffResult paramFileDiffResult)
  {
    super($anonymous0);val$result = paramFileDiffResult;
  }
  
  public String getName()
  {
    return val$result.getTargetPath().toString();
  }
}

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

import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.compare.internal.core.patch.HunkResult;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;

class PatchWorkspace$2
  extends LocalResourceTypedElement
{
  private final HunkResult val$result;
  
  PatchWorkspace$2(IResource $anonymous0, HunkResult paramHunkResult)
  {
    super($anonymous0);val$result = paramHunkResult;
  }
  
  public String getName()
  {
    return val$result.getHunk().getLabel();
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.internal.core.patch.DiffProject;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.core.patch.Hunk;
import org.eclipse.compare.internal.core.patch.HunkResult;
import org.eclipse.compare.internal.patch.HunkDiffNode;
import org.eclipse.compare.internal.patch.PatchFileDiffNode;
import org.eclipse.compare.internal.patch.PatchProjectDiffNode;
import org.eclipse.compare.internal.patch.WorkspaceFileDiffResult;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.compare.structuremergeviewer.DiffNode;
import org.eclipse.compare.structuremergeviewer.IDiffContainer;
import org.eclipse.compare.structuremergeviewer.IDiffElement;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;

public class PatchWorkspace
  extends DiffNode
  implements IAdaptable
{
  private WorkspacePatcher patcher;
  
  public PatchWorkspace(WorkspacePatcher patcher)
  {
    super(null, 0);
    this.patcher = patcher;
  }
  
  public WorkspacePatcher getPatcher()
  {
    return patcher;
  }
  
  public IResource getResource()
  {
    return ResourcesPlugin.getWorkspace().getRoot();
  }
  
  public String getName()
  {
    return "Patch Root Workspace";
  }
  
  public IDiffContainer getParent()
  {
    return null;
  }
  
  public IDiffElement[] getChildren()
  {
    IDiffElement[] children;
    IDiffElement[] children;
    if (getPatcher().isWorkspacePatch()) {
      children = processProjects(getPatcher().getDiffProjects());
    } else {
      children = processDiffs(getPatcher().getDiffs());
    }
    return children;
  }
  
  private IDiffElement[] processDiffs(FilePatch2[] diffs)
  {
    List result = new ArrayList();
    for (int i = 0; i < diffs.length; i++) {
      result.addAll(processDiff(diffs[i], this));
    }
    return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
  }
  
  private IDiffElement[] processProjects(DiffProject[] diffProjects)
  {
    List result = new ArrayList();
    for (int i = 0; i < diffProjects.length; i++)
    {
      PatchProjectDiffNode projectNode = new PatchProjectDiffNode(this, diffProjects[i], getPatcher().getConfiguration());
      result.add(projectNode);
      FilePatch2[] diffs = diffProjects[i].getFileDiffs();
      for (int j = 0; j < diffs.length; j++)
      {
        FilePatch2 fileDiff = diffs[j];
        processDiff(fileDiff, projectNode);
      }
    }
    return (IDiffElement[])result.toArray(new IDiffElement[result.size()]);
  }
  
  private List processDiff(FilePatch2 diff, DiffNode parent)
  {
    List result = new ArrayList();
    FileDiffResult diffResult = getPatcher().getDiffResult(diff);
    PatchFileDiffNode node = new PatchFileDiffNode(diffResult, parent, PatchFileDiffNode.getKind(diffResult), PatchFileDiffNode.getAncestorElement(diffResult), getLeftElement(diffResult), PatchFileDiffNode.getRightElement(diffResult));
    result.add(node);
    HunkResult[] hunkResults = diffResult.getHunkResults();
    for (int i = 0; i < hunkResults.length; i++)
    {
      HunkResult hunkResult = hunkResults[i];
      new HunkDiffNode(hunkResult, node, 3, HunkDiffNode.getAncestorElement(hunkResult, false), getLeftElement(hunkResult), HunkDiffNode.getRightElement(hunkResult, false));
    }
    return result;
  }
  
  private static ITypedElement getLeftElement(FileDiffResult result)
  {
    new LocalResourceTypedElement(((WorkspaceFileDiffResult)result).getTargetFile())
    {
      private final FileDiffResult val$result;
      
      public String getName()
      {
        return val$result.getTargetPath().toString();
      }
    };
  }
  
  private static ITypedElement getLeftElement(HunkResult result)
  {
    new LocalResourceTypedElement(((WorkspaceFileDiffResult)result.getDiffResult()).getTargetFile())
    {
      private final HunkResult val$result;
      
      public String getName()
      {
        return val$result.getHunk().getLabel();
      }
    };
  }
  
  public Object getAdapter(Class adapter)
  {
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

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

import java.io.InputStream;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;

class PatchedFileVariant$1
  implements IStorage
{
  final PatchedFileVariant this$0;
  
  PatchedFileVariant$1(PatchedFileVariant paramPatchedFileVariant)
  {
    this$0 = paramPatchedFileVariant;
  }
  
  public Object getAdapter(Class adapter)
  {
    return null;
  }
  
  public boolean isReadOnly()
  {
    return true;
  }
  
  public String getName()
  {
    return this$0.getName();
  }
  
  public IPath getFullPath()
  {
    return null;
  }
  
  public InputStream getContents()
    throws CoreException
  {
    FileDiffResult diffResult = PatchedFileVariant.access$0(this$0).getDiffResult(PatchedFileVariant.access$1(this$0));
    return diffResult.getPatchedContents();
  }
}

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

import java.io.InputStream;
import org.eclipse.compare.internal.core.patch.FileDiffResult;
import org.eclipse.compare.internal.core.patch.FilePatch2;
import org.eclipse.compare.internal.patch.WorkspacePatcher;
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.team.core.TeamException;
import org.eclipse.team.core.variants.IResourceVariant;

public class PatchedFileVariant
  implements IResourceVariant
{
  private FilePatch2 diff;
  private WorkspacePatcher patcher;
  
  public PatchedFileVariant(WorkspacePatcher patcher, FilePatch2 diff)
  {
    this.diff = diff;
    this.patcher = patcher;
  }
  
  public byte[] asBytes()
  {
    return null;
  }
  
  public String getContentIdentifier()
  {
    return "(After Patch)";
  }
  
  public String getName()
  {
    return diff.getPath(patcher.isReversed()).lastSegment();
  }
  
  public IStorage getStorage(IProgressMonitor monitor)
    throws TeamException
  {
    new IStorage()
    {
      public Object getAdapter(Class adapter)
      {
        return null;
      }
      
      public boolean isReadOnly()
      {
        return true;
      }
      
      public String getName()
      {
        return PatchedFileVariant.this.getName();
      }
      
      public IPath getFullPath()
      {
        return null;
      }
      
      public InputStream getContents()
        throws CoreException
      {
        FileDiffResult diffResult = patcher.getDiffResult(diff);
        return diffResult.getPatchedContents();
      }
    };
  }
  
  public boolean isContainer()
  {
    return false;
  }
  
  FilePatch2 getDiff()
  {
    return diff;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.core.variants.IResourceVariantComparator;
import org.eclipse.team.internal.core.mapping.LocalResourceVariant;

public class PatchedFileVariantComparator
  implements IResourceVariantComparator
{
  public boolean compare(IResource local, IResourceVariant remote)
  {
    if ((remote instanceof LocalResourceVariant)) {
      return true;
    }
    return false;
  }
  
  public boolean compare(IResourceVariant base, IResourceVariant remote)
  {
    return false;
  }
  
  public boolean isThreeWay()
  {
    return true;
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.ui.IConfigurationWizard;
import org.eclipse.team.ui.IConfigurationWizardExtension;
import org.eclipse.ui.IPluginContribution;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.ui.model.WorkbenchAdapter;

public class ConfigurationWizardElement
  extends WorkbenchAdapter
  implements IAdaptable, IPluginContribution
{
  private String id;
  private String name;
  private ImageDescriptor imageDescriptor;
  private IConfigurationElement configurationElement;
  
  public ConfigurationWizardElement(String name)
  {
    this.name = name;
  }
  
  public Object createExecutableExtension()
    throws CoreException
  {
    return TeamUIPlugin.createExtension(configurationElement, "class");
  }
  
  public IWizard createExecutableExtension(IProject[] projects)
    throws CoreException
  {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IConfigurationWizard wizard = (IConfigurationWizard)createExecutableExtension();
    IConfigurationWizardExtension extension = (IConfigurationWizardExtension)Utils.getAdapter(wizard, IConfigurationWizardExtension.class);
    if (extension == null)
    {
      if (projects.length == 1)
      {
        wizard.init(workbench, projects[0]);
      }
      else
      {
        try
        {
          wizard.dispose();
        }
        catch (RuntimeException e)
        {
          TeamUIPlugin.log(4, "An internal error occurred", e);
        }
        IWizard multiWizard = new ConfigureMultipleProjectsWizard(projects, this);
        return multiWizard;
      }
    }
    else {
      extension.init(workbench, projects);
    }
    return wizard;
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == IWorkbenchAdapter.class) {
      return this;
    }
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
  
  public IConfigurationElement getConfigurationElement()
  {
    return configurationElement;
  }
  
  public ImageDescriptor getImageDescriptor(Object element)
  {
    return imageDescriptor;
  }
  
  public String getLabel(Object element)
  {
    return name;
  }
  
  public String getID()
  {
    return id;
  }
  
  public ImageDescriptor getImageDescriptor()
  {
    return imageDescriptor;
  }
  
  public void setConfigurationElement(IConfigurationElement newConfigurationElement)
  {
    configurationElement = newConfigurationElement;
  }
  
  public void setDescription(String value) {}
  
  public void setID(String value)
  {
    id = value;
  }
  
  public void setImageDescriptor(ImageDescriptor value)
  {
    imageDescriptor = value;
  }
  
  public String getLocalId()
  {
    return configurationElement.getAttribute("id");
  }
  
  public String getPluginId()
  {
    return configurationElement.getNamespaceIdentifier();
  }
  
  public boolean wizardHasPages(IProject[] projects)
  {
    try
    {
      IWizard wizard = createExecutableExtension(projects);
      try
      {
        wizard.addPages();
        return wizard.getPageCount() > 0;
      }
      finally
      {
        wizard.dispose();
      }
      return false;
    }
    catch (CoreException e)
    {
      TeamUIPlugin.log(e);
    }
    catch (RuntimeException e)
    {
      TeamUIPlugin.log(4, "An internal error occurred", e);
    }
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.team.internal.ui.TeamUIMessages;

public class ConfigureMultipleProjectsWizard
  extends Wizard
{
  private final IProject[] projects;
  private final ConfigurationWizardElement element;
  private ProjectSelectionPage projectSelectionPage;
  
  public ConfigureMultipleProjectsWizard(IProject[] projects, ConfigurationWizardElement element)
  {
    this.projects = projects;
    this.element = element;
  }
  
  public void addPages()
  {
    projectSelectionPage = new ProjectSelectionPage(projects, element);
    addPage(projectSelectionPage);
  }
  
  public boolean performFinish()
  {
    if (projectSelectionPage.hasUnsharedProjects()) {
      return MessageDialog.openConfirm(getShell(), TeamUIMessages.ConfigureMultipleProjectsWizard_0, TeamUIMessages.ConfigureMultipleProjectsWizard_1);
    }
    return true;
  }
}

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

import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;

class ConfigureProjectWizard$ResizeWizardDialog
  extends WizardDialog
{
  public ConfigureProjectWizard$ResizeWizardDialog(Shell parentShell, IWizard newWizard)
  {
    super(parentShell, newWizard);
    setShellStyle(getShellStyle() | 0x10);
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.IActivityManager;
import org.eclipse.ui.activities.IIdentifier;
import org.eclipse.ui.activities.IWorkbenchActivitySupport;
import org.eclipse.ui.model.AdaptableList;

public class ConfigureProjectWizard
  extends Wizard
{
  protected IProject[] projects;
  protected ConfigureProjectWizardMainPage mainPage;
  protected static final String PT_CONFIGURATION = "configurationWizards";
  protected static final String TAG_WIZARD = "wizard";
  protected static final String TAG_DESCRIPTION = "description";
  protected static final String ATT_NAME = "name";
  protected static final String ATT_CLASS = "class";
  protected static final String ATT_ICON = "icon";
  protected static final String ATT_ID = "id";
  
  private ConfigureProjectWizard(IProject[] projects)
  {
    this.projects = projects;
    setNeedsProgressMonitor(true);
    setWindowTitle(TeamUIMessages.ConfigureProjectWizard_title);
  }
  
  public void addPages()
  {
    AdaptableList disabledWizards = new AdaptableList();
    AdaptableList wizards = getAvailableWizards(disabledWizards);
    mainPage = new ConfigureProjectWizardMainPage("configurePage1", TeamUIMessages.ConfigureProjectWizard_configureProject, TeamUIPlugin.getImageDescriptor("wizban/share_wizban.png"), wizards, disabledWizards);
    mainPage.setDescription(TeamUIMessages.ConfigureProjectWizard_description);
    mainPage.setProjects(projects);
    addPage(mainPage);
  }
  
  public boolean canFinish()
  {
    if (getContainer().getCurrentPage() == mainPage)
    {
      if ((mainPage.getSelectedWizard() != null) && (mainPage.getNextPage() == null)) {
        return true;
      }
      return false;
    }
    return super.canFinish();
  }
  
  public boolean performFinish()
  {
    mainPage.performFinish();
    if (getContainer().getCurrentPage() == mainPage)
    {
      IWizard noPageWizard = mainPage.getSelectedWizard();
      if ((noPageWizard != null) && 
        (noPageWizard.canFinish())) {
        return noPageWizard.performFinish();
      }
    }
    return true;
  }
  
  private static class ResizeWizardDialog
    extends WizardDialog
  {
    public ResizeWizardDialog(Shell parentShell, IWizard newWizard)
    {
      super(newWizard);
      setShellStyle(getShellStyle() | 0x10);
    }
  }
  
  public static void shareProjects(Shell shell, IProject[] projects)
  {
    IWizard wizard = null;
    
    AdaptableList disabledWizards = new AdaptableList();
    AdaptableList wizards = getAvailableWizards(disabledWizards);
    if ((wizards.size() == 1) && (disabledWizards.size() == 0))
    {
      ConfigurationWizardElement element = (ConfigurationWizardElement)wizards.getChildren()[0];
      if (element.wizardHasPages(projects)) {
        try
        {
          wizard = element.createExecutableExtension(projects);
        }
        catch (CoreException e)
        {
          TeamUIPlugin.log(e);
        }
      }
    }
    if (wizard == null)
    {
      wizard = new ConfigureProjectWizard(projects);
      ((ConfigureProjectWizard)wizard).setForcePreviousAndNextButtons(true);
    }
    openWizard(shell, wizard);
  }
  
  private static AdaptableList getAvailableWizards(AdaptableList disabledWizards)
  {
    AdaptableList result = new AdaptableList();
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint point = registry.getExtensionPoint("org.eclipse.team.ui", "configurationWizards");
    if (point != null)
    {
      IExtension[] extensions = point.getExtensions();
      for (int i = 0; i < extensions.length; i++)
      {
        IConfigurationElement[] elements = extensions[i].getConfigurationElements();
        for (int j = 0; j < elements.length; j++)
        {
          IConfigurationElement element = elements[j];
          if (element.getName().equals("wizard"))
          {
            ConfigurationWizardElement wizard = createWizardElement(element);
            if ((wizard != null) && (filterItem(element))) {
              disabledWizards.add(wizard);
            } else if (wizard != null) {
              result.add(wizard);
            }
          }
        }
      }
    }
    return result;
  }
  
  private static boolean filterItem(IConfigurationElement element)
  {
    String extensionId = element.getAttribute("id");
    String extensionPluginId = element.getNamespaceIdentifier();
    IActivityManager activityMgr = PlatformUI.getWorkbench().getActivitySupport().getActivityManager();
    IIdentifier id = activityMgr.getIdentifier(extensionPluginId + "/" + extensionId);
    return !id.isEnabled();
  }
  
  private static ConfigurationWizardElement createWizardElement(IConfigurationElement element)
  {
    String nameString = element.getAttribute("name");
    if (nameString == null) {
      return null;
    }
    ConfigurationWizardElement result = new ConfigurationWizardElement(nameString);
    if (initializeWizard(result, element)) {
      return result;
    }
    return null;
  }
  
  private static boolean initializeWizard(ConfigurationWizardElement element, IConfigurationElement config)
  {
    element.setID(config.getAttribute("id"));
    String description = "";
    IConfigurationElement[] children = config.getChildren("description");
    if (children.length >= 1) {
      description = children[0].getValue();
    }
    element.setDescription(description);
    
    element.setConfigurationElement(config);
    String iconName = config.getAttribute("icon");
    if (iconName != null)
    {
      IExtension extension = config.getDeclaringExtension();
      element.setImageDescriptor(TeamUIPlugin.getImageDescriptorFromExtension(extension, iconName));
    }
    if (element.getConfigurationElement() == null) {
      return false;
    }
    return true;
  }
  
  public static void openWizard(Shell shell, IWizard wizard)
  {
    WizardDialog dialog = new ResizeWizardDialog(shell, wizard);
    dialog.open();
  }
}

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

import org.eclipse.core.runtime.CoreException;
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.wizard.IWizard;

class ConfigureProjectWizardMainPage$1
  implements ISelectionChangedListener
{
  final ConfigureProjectWizardMainPage this$0;
  
  ConfigureProjectWizardMainPage$1(ConfigureProjectWizardMainPage paramConfigureProjectWizardMainPage)
  {
    this$0 = paramConfigureProjectWizardMainPage;
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    ISelection selection = event.getSelection();
    if ((selection == null) || (!(selection instanceof IStructuredSelection)))
    {
      ConfigureProjectWizardMainPage.access$0(this$0, null);
      ConfigureProjectWizardMainPage.access$1(this$0, null);
      this$0.setPageComplete(false);
      return;
    }
    IStructuredSelection ss = (IStructuredSelection)selection;
    if (ss.size() != 1)
    {
      ConfigureProjectWizardMainPage.access$0(this$0, null);
      ConfigureProjectWizardMainPage.access$1(this$0, null);
      this$0.setPageComplete(false);
      return;
    }
    ConfigurationWizardElement selectedElement = (ConfigurationWizardElement)ss.getFirstElement();
    try
    {
      ConfigureProjectWizardMainPage.access$0(this$0, selectedElement.createExecutableExtension(this$0.getUnsharedProjects()));
      ConfigureProjectWizardMainPage.access$1(this$0, selectedElement.getID());
    }
    catch (CoreException localCoreException)
    {
      return;
    }
    ConfigureProjectWizardMainPage.access$2(this$0).addPages();
    
    this$0.setPageComplete(true);
  }
}

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

import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;

class ConfigureProjectWizardMainPage$2
  implements IDoubleClickListener
{
  final ConfigureProjectWizardMainPage this$0;
  
  ConfigureProjectWizardMainPage$2(ConfigureProjectWizardMainPage paramConfigureProjectWizardMainPage)
  {
    this$0 = paramConfigureProjectWizardMainPage;
  }
  
  public void doubleClick(DoubleClickEvent event)
  {
    this$0.getWizard().getContainer().showPage(this$0.getNextPage());
  }
}

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

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;

class ConfigureProjectWizardMainPage$3
  extends ViewerComparator
{
  final ConfigureProjectWizardMainPage this$0;
  
  ConfigureProjectWizardMainPage$3(ConfigureProjectWizardMainPage paramConfigureProjectWizardMainPage)
  {
    this$0 = paramConfigureProjectWizardMainPage;
  }
  
  public int compare(Viewer viewer, Object e1, Object e2)
  {
    if (((e1 instanceof ConfigurationWizardElement)) && ((e2 instanceof ConfigurationWizardElement)))
    {
      ConfigurationWizardElement wizard1 = (ConfigurationWizardElement)e1;
      ConfigurationWizardElement wizard2 = (ConfigurationWizardElement)e2;
      return wizard1.getLabel(wizard1).compareToIgnoreCase(wizard2.getLabel(wizard2));
    }
    return super.compare(viewer, e1, e2);
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.ui.model.AdaptableList;

class ConfigureProjectWizardMainPage$4
  extends SelectionAdapter
{
  final ConfigureProjectWizardMainPage this$0;
  
  ConfigureProjectWizardMainPage$4(ConfigureProjectWizardMainPage paramConfigureProjectWizardMainPage)
  {
    this$0 = paramConfigureProjectWizardMainPage;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    ArrayList all = new ArrayList(Arrays.asList(ConfigureProjectWizardMainPage.access$3(this$0).getChildren()));
    if (ConfigureProjectWizardMainPage.access$4(this$0).getSelection()) {
      all.addAll(Arrays.asList(ConfigureProjectWizardMainPage.access$5(this$0).getChildren()));
    }
    ConfigureProjectWizardMainPage.access$6(this$0).setInput(new AdaptableList(all));
  }
}

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

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
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.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.internal.ui.TeamUIMessages;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.activities.ITriggerPoint;
import org.eclipse.ui.activities.ITriggerPointManager;
import org.eclipse.ui.activities.IWorkbenchActivitySupport;
import org.eclipse.ui.activities.WorkbenchActivityHelper;
import org.eclipse.ui.help.IWorkbenchHelpSystem;
import org.eclipse.ui.model.AdaptableList;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;

public class ConfigureProjectWizardMainPage
  extends WizardPage
{
  private Table table;
  private Button showAllToggle;
  private TableViewer viewer;
  private AdaptableList wizards;
  private AdaptableList disabledWizards;
  private IProject[] projects;
  private String description;
  private IWizard selectedWizard;
  private IDialogSettings settings;
  private static final String SELECTED_WIZARD_ID = "selectedWizardId";
  private String selectedWizardId;
  
  public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards, AdaptableList disabledWizards)
  {
    this(pageName, title, titleImage, wizards, disabledWizards, TeamUIMessages.ConfigureProjectWizardMainPage_selectRepository);
  }
  
  public ConfigureProjectWizardMainPage(String pageName, String title, ImageDescriptor titleImage, AdaptableList wizards, AdaptableList disabledWizards, String description)
  {
    super(pageName, title, titleImage);
    this.wizards = wizards;
    this.disabledWizards = disabledWizards;
    this.description = description;
  }
  
  public IWizard getSelectedWizard()
  {
    return selectedWizard;
  }
  
  public boolean canFlipToNextPage()
  {
    return (selectedWizard != null) && (selectedWizard.getPageCount() > 0);
  }
  
  public void createControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(1808));
    
    setControl(composite);
    
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, "org.eclipse.team.ui.share_pro
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