org.eclipse.mylyn.team.cvs_3.7.1.v20120425-0100

16:46:57.644 INFO  jd.cli.Main - Decompiling org.eclipse.mylyn.team.cvs_3.7.1.v20120425-0100.jar
package org.eclipse.mylyn.internal.team.ccvs;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.Platform;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.context.core.IInteractionContextManager;
import org.eclipse.mylyn.internal.resources.ui.ResourcesUiBridgePlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.team.ui.LinkedTaskInfo;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.team.ui.AbstractTaskReference;
import org.eclipse.mylyn.team.ui.IContextChangeSet;
import org.eclipse.mylyn.team.ui.TeamUiUtil;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.internal.ccvs.core.mapping.CVSActiveChangeSet;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;
import org.osgi.service.prefs.Preferences;

public class CvsContextChangeSet
  extends CVSActiveChangeSet
  implements IAdaptable, IContextChangeSet
{
  private static final String CTX_TITLE = "title";
  public static final String SOURCE_ID = "org.eclipse.mylyn.java.context.changeset.add";
  private final ITask task;
  
  public CvsContextChangeSet(ITask task, ActiveChangeSetManager manager)
  {
    super(manager, task.getSummary());
    this.task = task;
    updateLabel();
  }
  
  public boolean isUserCreated()
  {
    return true;
  }
  
  public void updateLabel()
  {
    super.setName(task.getSummary());
    super.setTitle(task.getSummary());
  }
  
  public void save(Preferences prefs)
  {
    super.save(prefs);
    prefs.put("title", getTitleForPersistance());
  }
  
  private String getTitleForPersistance()
  {
    return getTitle() + " (" + task.getHandleIdentifier() + ")";
  }
  
  public static String getHandleFromPersistedTitle(String title)
  {
    int delimStart = title.lastIndexOf('(');
    int delimEnd = title.lastIndexOf(')');
    if ((delimStart != -1) && (delimEnd != -1)) {
      return title.substring(delimStart + 1, delimEnd);
    }
    return null;
  }
  
  public String getComment()
  {
    return getComment(true);
  }
  
  public String getComment(boolean checkTaskRepository)
  {
    return TeamUiUtil.getComment(checkTaskRepository, task, getChangedResources());
  }
  
  public void remove(IResource resource)
  {
    super.remove(resource);
  }
  
  public void remove(IResource[] newResources)
  {
    super.remove(newResources);
  }
  
  public void add(IDiff diff)
  {
    super.add(diff);
  }
  
  public void add(IDiff[] diffs)
  {
    super.add(diffs);
  }
  
  public void add(IResource[] newResources)
    throws CoreException
  {
    super.add(newResources);
  }
  
  public void restoreResources(IResource[] newResources)
    throws CoreException
  {
    super.add(newResources);
    setComment(getComment(false));
  }
  
  public IResource[] getResources()
  {
    return super.getResources();
  }
  
  public IResource[] getChangedResources()
  {
    return super.getResources();
  }
  
  public List<IResource> getAllResourcesInChangeContext()
  {
    Set<IResource> allResources = new HashSet();
    allResources.addAll(Arrays.asList(super.getResources()));
    if ((Platform.isRunning()) && (ResourcesUiBridgePlugin.getDefault() != null) && (task.isActive())) {
      allResources.addAll(ResourcesUiBridgePlugin.getDefault().getInterestingResources(
        ContextCore.getContextManager().getActiveContext()));
    }
    return new ArrayList(allResources);
  }
  
  public boolean contains(IResource local)
  {
    return super.contains(local);
  }
  
  public boolean equals(Object object)
  {
    if (((object instanceof CvsContextChangeSet)) && (task != null))
    {
      CvsContextChangeSet changeSet = (CvsContextChangeSet)object;
      return task.equals(changeSet.getTask());
    }
    return super.equals(object);
  }
  
  public int hashCode()
  {
    if (task != null) {
      return task.hashCode();
    }
    return super.hashCode();
  }
  
  public ITask getTask()
  {
    return task;
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == AbstractTask.class) {
      return task;
    }
    if (adapter == AbstractTaskReference.class) {
      return new LinkedTaskInfo(getTask(), this);
    }
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CvsContextChangeSet
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.team.internal.ccvs.core.mapping.ChangeSetResourceMapping;
import org.eclipse.team.internal.core.subscribers.DiffChangeSet;

public class CvsChangeSetResourceMappingAdapterFactory
  implements IAdapterFactory
{
  private static final Class<?>[] ADAPTER_TYPES = { ResourceMapping.class };
  
  public Class[] getAdapterList()
  {
    return ADAPTER_TYPES;
  }
  
  public Object getAdapter(Object object, Class adapterType)
  {
    if ((ResourceMapping.class.equals(adapterType)) && ((object instanceof CvsContextChangeSet))) {
      return new ChangeSetResourceMapping((DiffChangeSet)object);
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CvsChangeSetResourceMappingAdapterFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.core.resources.IResource;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.ui.wizards.CommitWizard;

public class CommitContextWizard
  extends CommitWizard
{
  public CommitContextWizard(IResource[] resources, ITask task)
    throws CVSException
  {
    super(resources);
  }
  
  public void dispose()
  {
    try
    {
      super.dispose();
    }
    catch (Exception localException) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CommitContextWizard
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.team.ui.AbstractActiveChangeSetProvider;
import org.eclipse.mylyn.team.ui.IContextChangeSet;
import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;

public class CvsActiveChangeSetProvider
  extends AbstractActiveChangeSetProvider
{
  public ActiveChangeSetManager getActiveChangeSetManager()
  {
    return CVSUIPlugin.getPlugin().getChangeSetManager();
  }
  
  public IContextChangeSet createChangeSet(ITask task)
  {
    return new CvsContextChangeSet(task, getActiveChangeSetManager());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CvsActiveChangeSetProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.team.internal.ccvs.core.mapping.ChangeSetResourceMapping;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;

public class CvsChangeSetAdapterFactory
  implements IAdapterFactory
{
  public Object getAdapter(Object adaptableObject, Class adapterType)
  {
    if (((adaptableObject instanceof ActiveChangeSet)) && (adapterType == ResourceMapping.class))
    {
      ActiveChangeSet cs = (ActiveChangeSet)adaptableObject;
      return new ChangeSetResourceMapping(cs);
    }
    return null;
  }
  
  public Class[] getAdapterList()
  {
    return new Class[] { ResourceMapping.class };
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CvsChangeSetAdapterFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.team.ui.LinkedTaskInfo;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.team.ui.AbstractTaskReference;
import org.eclipse.mylyn.team.ui.IContextChangeSet;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
import org.eclipse.team.internal.ccvs.core.mapping.CVSCheckedInChangeSet;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
import org.eclipse.team.internal.core.subscribers.DiffChangeSet;

public class CvsLinkedTaskInfoAdapterFactory
  implements IAdapterFactory
{
  private static final Class<?>[] ADAPTER_TYPES = { AbstractTaskReference.class };
  
  public Class[] getAdapterList()
  {
    return ADAPTER_TYPES;
  }
  
  public Object getAdapter(Object object, Class adapterType)
  {
    if (!AbstractTaskReference.class.equals(adapterType)) {
      return null;
    }
    return adaptFromComment(object);
  }
  
  private AbstractTaskReference adaptFromComment(Object object)
  {
    String comment = getCommentForElement(object);
    if (comment == null) {
      return null;
    }
    long timestamp = 0L;
    if ((object instanceof CVSFileRevision)) {
      timestamp = ((CVSFileRevision)object).getTimestamp();
    }
    IResource resource = getResourceForElement(object);
    if (resource != null)
    {
      TaskRepository repository = TasksUiPlugin.getDefault().getRepositoryForResource(resource);
      if (repository != null) {
        return new LinkedTaskInfo(repository.getRepositoryUrl(), null, null, comment, timestamp);
      }
    }
    return new LinkedTaskInfo(null, null, null, comment);
  }
  
  private static String getCommentForElement(Object element)
  {
    if ((element instanceof IContextChangeSet)) {
      return ((IContextChangeSet)element).getComment(false);
    }
    if ((element instanceof DiffChangeSet)) {
      return ((DiffChangeSet)element).getComment();
    }
    if ((element instanceof LogEntry)) {
      return ((LogEntry)element).getComment();
    }
    if ((element instanceof IFileRevision)) {
      return ((IFileRevision)element).getComment();
    }
    if ((element instanceof CVSCheckedInChangeSet)) {
      return ((CVSCheckedInChangeSet)element).getComment();
    }
    return null;
  }
  
  private static IResource getResourceForElement(Object element)
  {
    if ((element instanceof IAdaptable))
    {
      IAdaptable adaptable = (IAdaptable)element;
      IResourceVariant resourceVariant = (IResourceVariant)adaptable.getAdapter(IResourceVariant.class);
      if ((resourceVariant != null) && ((resourceVariant instanceof RemoteResource)))
      {
        RemoteResource remoteResource = (RemoteResource)resourceVariant;
        
        String path = remoteResource.getRepositoryRelativePath();
        if (path != null)
        {
          IProject[] arrayOfIProject;
          int j = (arrayOfIProject = ResourcesPlugin.getWorkspace().getRoot().getProjects()).length;
          for (int i = 0; i < j; i++)
          {
            IProject project = arrayOfIProject[i];
            if (project.isAccessible())
            {
              ICVSResource cvsResource = CVSWorkspaceRoot.getCVSFolderFor(project);
              try
              {
                String repositoryRelativePath = cvsResource.getRepositoryRelativePath();
                if ((repositoryRelativePath != null) && (path.startsWith(repositoryRelativePath))) {
                  return project;
                }
              }
              catch (CVSException localCVSException) {}
            }
          }
        }
      }
    }
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CvsLinkedTaskInfoAdapterFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.internal.team.ui.AbstractCommitWorkflowProvider;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

public class CvsCommitWorkflowProvider
  extends AbstractCommitWorkflowProvider
{
  private static final String WIZARD_LABEL = Messages.CvsCommitWorkflowProvider_Commit_Resources_in_Task_Context;
  
  public boolean hasOutgoingChanges(IResource[] resources)
  {
    try
    {
      CommitContextWizard wizard = new CommitContextWizard(resources, null);
      return wizard.hasOutgoingChanges();
    }
    catch (CVSException localCVSException) {}
    return false;
  }
  
  public void commit(IResource[] resources)
  {
    try
    {
      CommitContextWizard wizard = new CommitContextWizard(resources, null);
      Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
      if ((shell != null) && (!shell.isDisposed()) && (wizard.hasOutgoingChanges()))
      {
        wizard.loadSize();
        WizardDialog dialog = new WizardDialog(shell, wizard);
        dialog.setMinimumPageSize(wizard.loadSize());
        dialog.create();
        dialog.setTitle(WIZARD_LABEL);
        dialog.setBlockOnOpen(true);
        dialog.open();
      }
    }
    catch (CVSException localCVSException) {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.CvsCommitWorkflowProvider
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.team.ccvs;

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.team.ccvs.messages";
  public static String CvsCommitWorkflowProvider_Commit_Resources_in_Task_Context;
  
  static {}
  
  public static void reloadMessages()
  {
    NLS.initializeMessages("org.eclipse.mylyn.internal.team.ccvs.messages", Messages.class);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.team.ccvs.Messages
 * 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