org.eclipse.mylyn.versions.ui_0.9.1.v20120425-0100

16:47:01.760 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.versions.ui_0.9.1.v20120425-0100.jar
package org.eclipse.mylyn.versions.ui.spi;

import org.eclipse.core.resources.IResource;
import org.eclipse.mylyn.versions.core.ChangeSet;
import org.eclipse.mylyn.versions.core.ScmRepository;

public abstract class ScmConnectorUi
{
  public abstract ChangeSet getChangeSet(ScmRepository paramScmRepository, IResource paramIResource);
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.versions.ui.spi.ScmConnectorUi
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.versions.ui;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.eclipse.compare.CompareUI;
import org.eclipse.compare.ITypedElement;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.versions.ui.spi.ScmConnectorUi;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.internal.core.history.LocalFileRevision;
import org.eclipse.team.internal.ui.history.CompareFileRevisionEditorInput;
import org.eclipse.team.internal.ui.history.FileRevisionTypedElement;
import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput;
import org.eclipse.ui.IWorkbenchPage;

public class ScmUi
{
  private static HashMap<String, ScmConnectorUi> connectorById = new HashMap();
  private static final String ID_PLUGIN = "org.eclipse.mylyn.versions.ui";
  
  private static class EmptyTypedElement
    implements ITypedElement
  {
    private final String name;
    
    public EmptyTypedElement(String name)
    {
      this.name = name;
    }
    
    public String getName()
    {
      return name;
    }
    
    public Image getImage()
    {
      return null;
    }
    
    public String getType()
    {
      return "???";
    }
  }
  
  protected static ITypedElement getElementFor(IResource resource)
  {
    return SaveableCompareEditorInput.createFileElement((IFile)resource);
  }
  
  private static IResource getResource(IFileRevision revision)
  {
    if ((revision instanceof LocalFileRevision))
    {
      LocalFileRevision local = (LocalFileRevision)revision;
      return local.getFile();
    }
    return null;
  }
  
  public static void openCompareEditor(IWorkbenchPage page, IFileRevision file1, IFileRevision file2)
  {
    Assert.isNotNull(file2);
    
    IResource resource = getResource(file2);
    if (resource != null)
    {
      IFileRevision temp = file1;
      file1 = file2;
      file2 = temp;
    }
    ITypedElement left;
    ITypedElement left;
    if (file1 != null)
    {
      resource = getResource(file1);
      ITypedElement left;
      if (resource != null) {
        left = getElementFor(resource);
      } else {
        left = new FileRevisionTypedElement(file1, null);
      }
    }
    else
    {
      left = new EmptyTypedElement(file2.getName());
    }
    ITypedElement right = new FileRevisionTypedElement(file2, null);
    
    CompareFileRevisionEditorInput input = new CompareFileRevisionEditorInput(left, right, page);
    
    CompareUI.openCompareEditor(input);
  }
  
  public static List<ScmConnectorUi> getAllRegisteredUiConnectors()
  {
    List<ScmConnectorUi> scmUiConnectors = new ArrayList();
    String[] teamProviderIds = RepositoryProvider.getAllProviderTypeIds();
    String[] arrayOfString1;
    int j = (arrayOfString1 = teamProviderIds).length;
    for (int i = 0; i < j; i++)
    {
      String providerId = arrayOfString1[i];
      ScmConnectorUi connector = getScmUiConnectorById(providerId);
      if (connector != null) {
        scmUiConnectors.add(connector);
      }
    }
    return scmUiConnectors;
  }
  
  public static ScmConnectorUi getUiConnector(IResource resource)
  {
    if (!RepositoryProvider.isShared(resource.getProject())) {
      return null;
    }
    RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject());
    return getScmUiConnectorById(provider.getID());
  }
  
  private static synchronized ScmConnectorUi getScmUiConnectorById(String id)
  {
    ScmConnectorUi connector = (ScmConnectorUi)connectorById.get(id);
    if (connector == null)
    {
      connector = loadConnector(id);
      connectorById.put(id, connector);
    }
    return connector;
  }
  
  private static ScmConnectorUi loadConnector(String id)
  {
    Assert.isNotNull(id);
    MultiStatus result = new MultiStatus("org.eclipse.mylyn.versions.ui", 0, "Scm ui connectors failed to load.", null);
    
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IExtensionPoint connectorsExtensionPoint = registry.getExtensionPoint("org.eclipse.mylyn.versions.ui.connectors");
    IExtension[] extensions = connectorsExtensionPoint.getExtensions();
    IExtension[] arrayOfIExtension1;
    int j = (arrayOfIExtension1 = extensions).length;
    for (int i = 0; i < j; i++)
    {
      IExtension extension = arrayOfIExtension1[i];
      IConfigurationElement[] elements = extension.getConfigurationElements();
      IConfigurationElement[] arrayOfIConfigurationElement1;
      int m = (arrayOfIConfigurationElement1 = elements).length;
      for (int k = 0; k < m; k++)
      {
        IConfigurationElement element = arrayOfIConfigurationElement1[k];
        if (id.equals(element.getAttribute("id"))) {
          try
          {
            Object object = element.createExecutableExtension("ui");
            if ((object instanceof ScmConnectorUi)) {
              return (ScmConnectorUi)object;
            }
            result.add(new Status(
              4, 
              "org.eclipse.mylyn.versions.ui", 
              NLS.bind(
              "Connector ui ''{0}'' does not extend expected class for extension contributed by {1}", 
              object.getClass().getCanonicalName(), element.getContributor().getName())));
          }
          catch (Throwable e)
          {
            result.add(new Status(
              4, 
              "org.eclipse.mylyn.versions.ui", 
              NLS.bind(
              "Connector core failed to load for extension contributed by {0}", element.getContributor().getName()), e));
          }
        }
      }
    }
    if (!result.isOK()) {
      StatusHandler.log(result);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.versions.ui.ScmUi
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.versions.ui;

import org.eclipse.compare.ITypedElement;
import org.eclipse.swt.graphics.Image;

class ScmUi$EmptyTypedElement
  implements ITypedElement
{
  private final String name;
  
  public ScmUi$EmptyTypedElement(String name)
  {
    this.name = name;
  }
  
  public String getName()
  {
    return name;
  }
  
  public Image getImage()
  {
    return null;
  }
  
  public String getType()
  {
    return "???";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.versions.ui.ScmUi.EmptyTypedElement
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
1

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-2017. Infinite Loop Ltd