org.eclipse.team.cvs.core_3.3.400.I20110510-0800

cvs/core/client/Command$LocalOption;
    //   52: astore 5
    //   54: aload_3
    //   55: aload_2
    //   56: bipush 10
    //   58: invokestatic 239	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   61: invokevirtual 245	org/eclipse/team/internal/ccvs/core/client/Session:open	(Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   64: new 121	org/eclipse/team/internal/ccvs/core/client/RLog
    //   67: dup
    //   68: invokespecial 240	org/eclipse/team/internal/ccvs/core/client/RLog:<init>	()V
    //   71: astore 6
    //   73: aload 6
    //   75: aload_3
    //   76: getstatic 226	org/eclipse/team/internal/ccvs/core/client/Command:NO_GLOBAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;
    //   79: aload 5
    //   81: iconst_1
    //   82: anewarray 115	org/eclipse/team/internal/ccvs/core/ICVSRemoteResource
    //   85: dup
    //   86: iconst_0
    //   87: aload_0
    //   88: getfield 230	org/eclipse/team/internal/ccvs/core/filesystem/RemoteLogger:remoteFolder	Lorg/eclipse/team/internal/ccvs/core/ICVSRemoteFolder;
    //   91: aastore
    //   92: aload 4
    //   94: aload_2
    //   95: bipush 90
    //   97: invokestatic 239	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   100: invokevirtual 243	org/eclipse/team/internal/ccvs/core/client/RLog:execute	(Lorg/eclipse/team/internal/ccvs/core/client/Session;[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;[Lorg/eclipse/team/internal/ccvs/core/ICVSResource;Lorg/eclipse/team/internal/ccvs/core/client/listeners/ICommandOutputListener;Lorg/eclipse/core/runtime/IProgressMonitor;)Lorg/eclipse/core/runtime/IStatus;
    //   103: pop
    //   104: goto +16 -> 120
    //   107: pop
    //   108: goto +12 -> 120
    //   111: astore 7
    //   113: aload_3
    //   114: invokevirtual 244	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   117: aload 7
    //   119: athrow
    //   120: aload_3
    //   121: invokevirtual 244	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   124: return
    // Line number table:
    //   Java source line #38	-> byte code offset #0
    //   Java source line #41	-> byte code offset #22
    //   Java source line #42	-> byte code offset #33
    //   Java source line #44	-> byte code offset #46
    //   Java source line #46	-> byte code offset #54
    //   Java source line #47	-> byte code offset #64
    //   Java source line #48	-> byte code offset #73
    //   Java source line #49	-> byte code offset #107
    //   Java source line #51	-> byte code offset #111
    //   Java source line #52	-> byte code offset #113
    //   Java source line #53	-> byte code offset #117
    //   Java source line #52	-> byte code offset #120
    //   Java source line #54	-> byte code offset #124
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	125	0	this	RemoteLogger
    //   0	125	1	tag	CVSTag
    //   0	125	2	monitor	IProgressMonitor
    //   21	100	3	session	org.eclipse.team.internal.ccvs.core.client.Session
    //   44	49	4	listener	org.eclipse.team.internal.ccvs.core.client.listeners.LogListener
    //   52	28	5	localOptions	Command.LocalOption[]
    //   71	3	6	rlog	RLog
    //   111	7	7	localObject	Object
    //   107	1	8	localCVSException	CVSException
    // Exception table:
    //   from	to	target	type
    //   54	104	107	org/eclipse/team/internal/ccvs/core/CVSException
    //   22	111	111	finally
  }
  
  public ICVSResource[] fetchChildren(IProgressMonitor monitor)
    throws CVSException, TeamException
  {
    return fetchTree(monitor).getChildren();
  }
  
  public HashMap getFolderMap()
  {
    return treeBuilder.getFolderMap();
  }
  
  public RemoteFolderTree fetchTree(IProgressMonitor monitor)
    throws CVSException, TeamException
  {
    try
    {
      monitor.beginTask(null, 100);
      CVSTag tag = remoteFolder.getTag();
      if (tag == null) {
        tag = CVSTag.DEFAULT;
      }
      getRemoteChildren(tag, new SubProgressMonitor(monitor, 70));
      
      ICVSRemoteFolder project = remoteFolder;
      
      String[] entry = cache.getCachedFilePaths();
      
      treeBuilder = new RLogTreeBuilder(project.getRepository(), tag, cache);
      for (int i = 0; i < entry.length; i++)
      {
        ILogEntry[] logEntry = cache.getLogEntries(entry[i]);
        if ((logEntry[0].getState() == null) || (!logEntry[0].getState().equals("dead")))
        {
          ICVSRemoteFile remoteFile = logEntry[0].getRemoteFile();
          if ((tag.getType() == 1) && (remoteFile.getRevision().equals("branchRevision"))) {
            verifyRevision(tag, logEntry[0], remoteFile);
          }
          IPath logPath = new Path(null, remoteFile.getRepositoryRelativePath());
          if (logPath.segmentCount() > 0)
          {
            String[] pathSegments = logPath.segments();
            
            String projectName = project.getName();
            for (int index = 0; index < pathSegments.length; index++) {
              if (pathSegments[index].equals(projectName)) {
                break;
              }
            }
            logPath = logPath.removeFirstSegments(index + 1);
          }
          treeBuilder.newFile(logPath, remoteFile);
        }
      }
      return treeBuilder.getTree();
    }
    finally
    {
      monitor.done();
    }
  }
  
  protected Command.LocalOption[] getLocalOptions(CVSTag tag1, CVSTag tag2)
  {
    if ((tag1 != null) && (tag2 != null)) {
      return new Command.LocalOption[] { RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.makeTagOption(tag1, tag2) };
    }
    if (tag1 != null)
    {
      if ((tag1.getType() == 0) || (tag1.getType() == 2)) {
        return new Command.LocalOption[] { RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.getCurrentTag(tag1) };
      }
      if (tag1.getType() == 3) {
        return new Command.LocalOption[] { RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES, RLog.REVISIONS_ON_DEFAULT_BRANCH, RLog.getCurrentTag(tag1) };
      }
      return new Command.LocalOption[] { RLog.getCurrentTag(tag1) };
    }
    return new Command.LocalOption[] { RLog.NO_TAGS, RLog.ONLY_INCLUDE_CHANGES };
  }
  
  private void verifyRevision(CVSTag tag, ILogEntry entry, ICVSRemoteFile remoteFile)
    throws CVSException
  {
    if ((entry instanceof LogEntry))
    {
      LogEntry logEntry = (LogEntry)entry;
      String[] allBranchRevisions = logEntry.getBranchRevisions();
      CVSTag[] allCVSTags = entry.getTags();
      for (int i = 0; i < allCVSTags.length; i++) {
        if (allCVSTags[i].equals(tag))
        {
          ((RemoteFile)remoteFile).setRevision(allBranchRevisions[i]);
          break;
        }
      }
    }
  }
  
  public HashMap getLogMap()
  {
    return treeBuilder.getLogMap();
  }
}

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

import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager;

public class CVSActiveChangeSet
  extends ActiveChangeSet
{
  public CVSActiveChangeSet(ActiveChangeSetManager manager, String title)
  {
    super(manager, title);
  }
}

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

import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.internal.core.subscribers.ActiveChangeSet;
import org.eclipse.team.internal.core.subscribers.SubscriberChangeSetManager;

public class CVSActiveChangeSetCollector
  extends SubscriberChangeSetManager
{
  public CVSActiveChangeSetCollector(Subscriber subscriber)
  {
    super(subscriber);
  }
  
  protected ActiveChangeSet doCreateSet(String name)
  {
    return new CVSActiveChangeSet(this, name);
  }
}

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

import com.ibm.icu.text.DateFormat;
import java.util.Date;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
import org.eclipse.team.internal.core.subscribers.DiffChangeSet;

public class CVSCheckedInChangeSet
  extends DiffChangeSet
{
  private final ILogEntry entry;
  
  public CVSCheckedInChangeSet(ILogEntry entry)
  {
    this.entry = entry;
    Date date = entry.getDate();
    String comment = LogEntry.flattenText(entry.getComment());
    if (date == null)
    {
      setName("[" + entry.getAuthor() + "] " + comment);
    }
    else
    {
      String dateString = DateFormat.getDateTimeInstance().format(date);
      setName("[" + entry.getAuthor() + "] (" + dateString + ") " + comment);
    }
  }
  
  public String getAuthor()
  {
    return entry.getAuthor();
  }
  
  public Date getDate()
  {
    return entry.getDate();
  }
  
  public String getComment()
  {
    return entry.getComment();
  }
}

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

import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.IAdapterFactory;

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

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

import org.eclipse.core.resources.mapping.IModelProviderDescriptor;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.internal.core.TeamPlugin;

public class ChangeSetModelProvider
  extends ModelProvider
{
  public static final String ID = "org.eclipse.team.cvs.core.changeSetModel";
  private static ChangeSetModelProvider provider;
  
  public static ChangeSetModelProvider getProvider()
  {
    if (provider == null) {
      try
      {
        provider = (ChangeSetModelProvider)ModelProvider.getModelProviderDescriptor("org.eclipse.team.cvs.core.changeSetModel").getModelProvider();
      }
      catch (CoreException e)
      {
        TeamPlugin.log(e);
      }
    }
    return provider;
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IProject;
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.IProgressMonitor;
import org.eclipse.team.internal.core.subscribers.DiffChangeSet;

public class ChangeSetResourceMapping
  extends ResourceMapping
{
  private final DiffChangeSet changeSet;
  
  public ChangeSetResourceMapping(DiffChangeSet changeSet)
  {
    this.changeSet = changeSet;
  }
  
  public Object getModelObject()
  {
    return changeSet;
  }
  
  public String getModelProviderId()
  {
    return "org.eclipse.team.cvs.core.changeSetModel";
  }
  
  public IProject[] getProjects()
  {
    Set result = new HashSet();
    IResource[] resources = changeSet.getResources();
    for (int i = 0; i < resources.length; i++)
    {
      IResource resource = resources[i];
      result.add(resource.getProject());
    }
    return (IProject[])result.toArray(new IProject[result.size()]);
  }
  
  public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor)
    throws CoreException
  {
    IResource[] resources = changeSet.getResources();
    if (resources.length == 0) {
      return new ResourceTraversal[0];
    }
    return new ResourceTraversal[] {
      new ResourceTraversal(resources, 0, 0) };
  }
}

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

import org.eclipse.team.internal.core.subscribers.DiffChangeSet;

public class UnassignedDiffChangeSet
  extends DiffChangeSet
{
  public UnassignedDiffChangeSet(String name)
  {
    super(name);
  }
}

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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSTag;

public class CVSEntryLineTag
  extends CVSTag
{
  private static final String ENTRY_LINE_DATE_TAG_FORMAT = "yyyy.MM.dd.HH.mm.ss";
  private static SimpleDateFormat entryLineDateTagFormatter = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss", Locale.US);
  
  private static String getNameInInternalFormat(CVSTag tag)
  {
    if (tag.getType() == 3)
    {
      String s = ensureEntryLineFormat(tag.getName());
      if (s != null) {
        return s;
      }
    }
    return tag.getName();
  }
  
  private static synchronized String ensureEntryLineFormat(String text)
  {
    if (text.length() == "yyyy.MM.dd.HH.mm.ss".length()) {
      return text;
    }
    Date date = tagNameToDate(text);
    if (date == null) {
      return text;
    }
    entryLineDateTagFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
    return entryLineDateTagFormatter.format(date);
  }
  
  public static synchronized Date entryLineToDate(String text)
  {
    try
    {
      entryLineDateTagFormatter.setTimeZone(TimeZone.getTimeZone("GMT"));
      return entryLineDateTagFormatter.parse(text);
    }
    catch (ParseException e)
    {
      CVSProviderPlugin.log(new CVSStatus(4, 4, "Tag name " + text + " is not of the expected format " + "yyyy.MM.dd.HH.mm.ss", e));
    }
    return null;
  }
  
  public CVSEntryLineTag(CVSTag tag)
  {
    super(getNameInInternalFormat(tag), tag.getType());
  }
  
  public CVSEntryLineTag(String entryLineTag)
  {
    switch (entryLineTag.charAt(0))
    {
    case 'T': 
      type = 1; break;
    case 'N': 
      type = 2; break;
    case 'D': 
      type = 3; break;
    default: 
      type = 0;
    }
    name = entryLineTag.substring(1);
  }
  
  public String getName()
  {
    if (getType() == 3)
    {
      Date date = asDate();
      if (date != null) {
        return dateToTagName(date);
      }
    }
    return name;
  }
  
  public int getType()
  {
    return type;
  }
  
  public String toEntryLineFormat(boolean useSamePrefixForBranchAndTag)
  {
    if ((type == 1) || ((type == 2) && (useSamePrefixForBranchAndTag))) {
      return "T" + name;
    }
    if (type == 2) {
      return "N" + name;
    }
    if (type == 3) {
      return "D" + name;
    }
    return "";
  }
  
  public String toString()
  {
    return toEntryLineFormat(false);
  }
  
  public Date asDate()
  {
    return entryLineToDate(name);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.CVSEntryLineTag
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;
import org.eclipse.team.internal.ccvs.core.util.Util;

public class CVSWorkspaceRoot
{
  private ICVSFolder localRoot;
  
  public CVSWorkspaceRoot(IContainer resource)
  {
    localRoot = getCVSFolderFor(resource);
  }
  
  public static void setSharing(IProject project, FolderSyncInfo info, IProgressMonitor monitor)
    throws TeamException
  {
    ICVSFolder folder = (ICVSFolder)getCVSResourceFor(project);
    FolderSyncInfo folderInfo = folder.getFolderSyncInfo();
    if (!info.equals(folderInfo)) {
      throw new CVSException(new CVSStatus(4, NLS.bind(CVSMessages.CVSProvider_infoMismatch, new String[] { project.getName() })));
    }
    String root = info.getRoot();
    
    KnownRepositories.getInstance().getRepository(root);
    
    RepositoryProvider.map(project, CVSProviderPlugin.getTypeId());
  }
  
  public static ICVSFolder getCVSFolderFor(IContainer resource)
  {
    return new EclipseFolder(resource);
  }
  
  public static ICVSFile getCVSFileFor(IFile resource)
  {
    return new EclipseFile(resource);
  }
  
  public static ICVSResource getCVSResourceFor(IResource resource)
  {
    if (resource.getType() == 1) {
      return getCVSFileFor((IFile)resource);
    }
    return getCVSFolderFor((IContainer)resource);
  }
  
  public static ICVSRemoteResource getRemoteResourceFor(IResource resource)
    throws CVSException
  {
    ICVSResource managed = getCVSResourceFor(resource);
    return getRemoteResourceFor(managed);
  }
  
  public static ICVSRemoteResource getRemoteResourceFor(ICVSResource resource)
    throws CVSException
  {
    if (resource.isFolder())
    {
      ICVSFolder folder = (ICVSFolder)resource;
      FolderSyncInfo syncInfo = folder.getFolderSyncInfo();
      if (syncInfo != null) {
        return new RemoteFolder(null, KnownRepositories.getInstance().getRepository(syncInfo.getRoot()), syncInfo.getRepository(), syncInfo.getTag());
      }
    }
    else if (resource.isManaged())
    {
      RemoteFolder parent = (RemoteFolder)getRemoteResourceFor(resource.getParent());
      if (parent == null)
      {
        if (resource.isManaged()) {
          CVSProviderPlugin.log(new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSWorkspaceRoot_11, new String[] { Util.getFullestPath(resource) }), resource.getIResource()));
        }
      }
      else {
        return RemoteFile.getBase(parent, (ICVSFile)resource);
      }
    }
    return null;
  }
  
  private static ICVSRemoteResource getRemoteTreeFromParent(IResource resource, ICVSResource managed, CVSTag tag, IProgressMonitor progress)
    throws TeamException
  {
    ICVSFolder parent = managed.getParent();
    FolderSyncInfo syncInfo = parent.getFolderSyncInfo();
    if (syncInfo == null) {
      return null;
    }
    ICVSRepositoryLocation location = KnownRepositories.getInstance().getRepository(parent.getFolderSyncInfo().getRoot());
    RemoteFolder remoteParent = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, parent, tag, progress);
    ICVSRemoteResource remote = null;
    if (remoteParent != null)
    {
      try
      {
        remote = (ICVSRemoteResource)remoteParent.getChild(resource.getName());
      }
      catch (CVSException localCVSException)
      {
        remote = null;
      }
      if ((remote != null) && (remote.isContainer() != managed.isFolder())) {
        throw new CVSException(new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSTeamProvider_typesDiffer, new String[] { resource.getFullPath().toString() }), resource));
      }
    }
    return remote;
  }
  
  public static ICVSRemoteResource getRemoteTree(IResource resource, CVSTag tag, boolean cacheFileContentsHint, int depth, IProgressMonitor progress)
    throws TeamException
  {
    ICVSResource managed = getCVSResourceFor(resource);
    ICVSRemoteResource remote = getRemoteResourceFor(resource);
    if (remote == null)
    {
      progress.beginTask(null, 100);
      remote = getRemoteTreeFromParent(resource, managed, tag, Policy.subMonitorFor(progress, 50));
      if ((cacheFileContentsHint) && (remote != null) && ((remote instanceof RemoteFile)))
      {
        RemoteFile file = (RemoteFile)remote;
        
        file.getStorage(Policy.subMonitorFor(progress, 50));
      }
      progress.done();
    }
    else if (resource.getType() == 1)
    {
      ICVSRepositoryLocation location = remote.getRepository();
      if (cacheFileContentsHint) {
        remote = UpdateContentCachingService.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFile)managed, tag, progress);
      } else {
        remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFile)managed, tag, progress);
      }
    }
    else
    {
      ICVSRepositoryLocation location = remote.getRepository();
      if (cacheFileContentsHint) {
        remote = UpdateContentCachingService.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, depth, progress);
      } else {
        remote = RemoteFolderTreeBuilder.buildRemoteTree((CVSRepositoryLocation)location, (ICVSFolder)managed, tag, progress);
      }
    }
    return remote;
  }
  
  public static boolean hasRemote(IResource resource)
  {
    try
    {
      ICVSResource cvsResource = getCVSResourceFor(resource);
      int type = resource.getType();
      if (type != 1)
      {
        if (type == 4) {
          return ((ICVSFolder)cvsResource).isCVSFolder();
        }
        return cvsResource.isManaged();
      }
      byte[] syncBytes = ((ICVSFile)cvsResource).getSyncBytes();
      if (syncBytes != null) {
        return !ResourceSyncInfo.isAddition(syncBytes);
      }
      return false;
    }
    catch (CVSException localCVSException) {}
    return false;
  }
  
  public ICVSRepositoryLocation getRemoteLocation()
    throws CVSException
  {
    FolderSyncInfo info = localRoot.getFolderSyncInfo();
    if (info == null)
    {
      IStatus status = new CVSStatus(4, 1, NLS.bind(CVSMessages.CVSWorkspaceRoot_notCVSFolder, new String[] { localRoot.getName() }), localRoot);
      throw new CVSException(status);
    }
    return KnownRepositories.getInstance().getRepository(info.getRoot());
  }
  
  public ICVSFolder getLocalRoot()
  {
    return localRoot;
  }
  
  public static boolean isLinkedResource(IResource resource)
  {
    return resource.isLinked(512);
  }
  
  public static boolean isSharedWithCVS(IResource resource)
    throws CVSException
  {
    if (!resource.isAccessible()) {
      return false;
    }
    if (isLinkedResource(resource)) {
      return false;
    }
    if (RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()) == null) {
      return false;
    }
    ICVSResource cvsResource = getCVSResourceFor(resource);
    if (cvsResource.isManaged()) {
      return true;
    }
    if (!cvsResource.exists()) {
      return false;
    }
    if ((cvsResource.isFolder()) && (((ICVSFolder)cvsResource).isCVSFolder())) {
      return true;
    }
    if (cvsResource.isIgnored()) {
      return false;
    }
    return cvsResource.getParent().isCVSFolder();
  }
  
  public static boolean isOrphanedSubtree(IContainer container)
    throws CVSException
  {
    ICVSFolder mFolder = getCVSFolderFor(container);
    
    return (mFolder.isCVSFolder()) && (!mFolder.isManaged()) && (mFolder.getIResource().getType() == 2) && (!isLinkedResource(container));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.syncinfo.BaserevInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

class EclipseFile$1
  implements ICVSRunnable
{
  final EclipseFile this$0;
  private final int val$notifications;
  
  EclipseFile$1(EclipseFile paramEclipseFile, int paramInt)
  {
    this$0 = paramEclipseFile;val$notifications = paramInt;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    byte[] syncBytes = this$0.getSyncBytes();
    if ((syncBytes == null) || (ResourceSyncInfo.isAddition(syncBytes))) {
      return;
    }
    char[] internalFormat;
    char[] internalFormat;
    if (val$notifications == 0)
    {
      internalFormat = (char[])null;
    }
    else
    {
      char[] internalFormat;
      if (val$notifications == 7)
      {
        internalFormat = NotifyInfo.ALL;
      }
      else
      {
        List notificationCharacters = new ArrayList();
        if ((val$notifications & 0x1) > 0) {
          notificationCharacters.add(new Character('E'));
        }
        if ((val$notifications & 0x2) > 0) {
          notificationCharacters.add(new Character('U'));
        }
        if ((val$notifications & 0x4) > 0) {
          notificationCharacters.add(new Character('C'));
        }
        internalFormat = new char[notificationCharacters.size()];
        for (int i = 0; i < internalFormat.length; i++) {
          internalFormat[i] = ((Character)notificationCharacters.get(i)).charValue();
        }
      }
    }
    NotifyInfo notifyInfo = new NotifyInfo(this$0.getName(), 'E', new Date(), internalFormat);
    this$0.setNotifyInfo(notifyInfo);
    if (!this$0.isModified(null))
    {
      EclipseSynchronizer.getInstance().copyFileToBaseDirectory(this$0.getIFile(), monitor);
      this$0.setBaserevInfo(new BaserevInfo(this$0.getName(), ResourceSyncInfo.getRevision(syncBytes)));
    }
    try
    {
      this$0.setReadOnly(false);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.EclipseFile.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import java.util.Date;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.syncinfo.BaserevInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

class EclipseFile$2
  implements ICVSRunnable
{
  final EclipseFile this$0;
  
  EclipseFile$2(EclipseFile paramEclipseFile)
  {
    this$0 = paramEclipseFile;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    NotifyInfo info = this$0.getNotifyInfo();
    if ((info != null) && (info.getNotificationType() == 'E')) {
      info = null;
    } else {
      info = new NotifyInfo(this$0.getName(), 'U', new Date(), null);
    }
    this$0.setNotifyInfo(info);
    if (this$0.isModified(null))
    {
      ResourceSyncInfo syncInfo = this$0.getSyncInfo();
      BaserevInfo baserevInfo = this$0.getBaserevInfo();
      EclipseSynchronizer.getInstance().restoreFileFromBaseDirectory(this$0.getIFile(), monitor);
      if (!syncInfo.getRevision().equals(baserevInfo.getRevision()))
      {
        MutableResourceSyncInfo newInfo = syncInfo.cloneMutable();
        newInfo.setRevision(baserevInfo.getRevision());
        newInfo.setTimeStamp(this$0.getTimeStamp());
        newInfo.setDeleted(false);
        this$0.setSyncInfo(newInfo, 1);
      }
      else
      {
        EclipseSynchronizer.getInstance().setModified(this$0, 1);
      }
    }
    else
    {
      this$0.setSyncBytes(this$0.getSyncBytes(), 1);
    }
    this$0.setBaserevInfo(null);
    try
    {
      this$0.setReadOnly(true);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.EclipseFile.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;

class EclipseFile$3
  implements ICVSRunnable
{
  final EclipseFile this$0;
  
  EclipseFile$3(EclipseFile paramEclipseFile)
  {
    this$0 = paramEclipseFile;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    EclipseFile.access$0(this$0, monitor);
    EclipseFile.access$1(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.resources.EclipseFile.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.team.internal.ccvs.core.resources;

import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourceAttributes;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.ICVSRunnable;
import org.eclipse.team.internal.ccvs.core.ILogEntry;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.syncinfo.BaserevInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.NotifyInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

public class EclipseFile
  extends EclipseResource
  implements ICVSFile
{
  private static final String TEMP_FILE_EXTENSION = ".tmp";
  private static final IPath PROJECT_META_DATA_PATH = new Path(".project");
  
  protected EclipseFile(IFile file)
  {
    super(file);
  }
  
  public void delete()
    throws CVSException
  {
    try
    {
      ((IFile)resource).delete(false, true, null);
    }
    catch (CoreException e)
    {
      throw CVSException.wrapException(resource, NLS.bind(CVSMessages.EclipseFile_Problem_deleting_resource, new String[] { resource.getFullPath().toString(), e.getStatus().getMessage() }), e);
    }
  }
  
  public long getSize()
  {
    return getIOFile().length();
  }
  
  public InputStream getContents()
    throws CVSException
  {
    try
    {
      return getIFile().getContents();
    }
    catch (CoreException e)
    {
      throw CVSException.wrapException(resource, NLS.bind(CVSMessages.EclipseFile_Problem_accessing_resource, new String[] { resource.getFullPath().toString(), e.getStatus().getMessage() }), e);
    }
  }
  
  public Date getTimeStamp()
  {
    long timestamp = getIFile().getLocalTimeStamp();
    if (timestamp == -1L) {
      return new Date(0L);
    }
    return new Date(timestamp / 1000L * 1000L);
  }
  
  public void setTimeStamp(Date date)
    throws CVSException
  {
    long time;
    long time;
    if (date == null) {
      time = System.currentTimeMillis();
    } else {
      time = date.getTime();
    }
    EclipseSynchronizer.getInstance().setTimeStamp(this, time);
  }
  
  public boolean isFolder()
  {
    return false;
  }
  
  public boolean isModified(IProgressMonitor monitor)
    throws CVSException
  {
    if (!exists()) {
      return getSyncBytes() != null;
    }
    int state = EclipseSynchronizer.getInstance().getModificationState(getIFile());
    if (state != 0)
    {
      boolean dirty = state != 1;
      if (dirty == isDirty()) {
        return dirty;
      }
    }
    byte[] syncBytes = getSyncBytes();
    if ((syncBytes == null) && (isIgnored())) {
      return false;
    }
    return EclipseSynchronizer.getInstance().setModified(this, 0);
  }
  
  public void accept(ICVSResourceVisitor visitor)
    throws CVSException
  {
    visitor.visitFile(this);
  }
  
  public void accept(ICVSResourceVisitor visitor, boolean recurse)
    throws CVSException
  {
    visitor.visitFile(this);
  }
  
  public void copyTo(String filename)
    throws CVSException
  {
    try
    {
      IPath targetPath = new Path(null, filename);
      IFile targetFile = getIFile().getParent().getFile(targetPath);
      if (targetFile.exists()) {
        targetFile.delete(false, true, null);
      }
      getIFile().copy(targetPath, true, null);
    }
    catch (CoreException e)
    {
      throw new CVSException(e.getStatus());
    }
  }
  
  public String getRemoteLocation(ICVSFolder stopSearching)
    throws CVSException
  {
    return getParent().getRemoteLocation(stopSearching) + "/" + getName();
  }
  
  public void setContents(InputStream stream, int responseType, boolean keepLocalHistory, IProgressMonitor monitor)
    throws CVSException
  {
    try
    {
      IFile file = getIFile();
      if (PROJECT_META_DATA_PATH.equals(file.getFullPath().removeFirstSegments(1))) {
        responseType = 1;
      }
      switch (responseType)
      {
      case 1: 
        if (resource.exists()) {
          file.setContents(stream, false, true, monitor);
        }
        break;
      case 4: 
        file.create(stream, false, monitor);
        break;
      case 2: 
        IFile tempFile = file.getParent().getFile(new Path(null, file.getName() + ".tmp"));
        monitor.beginTask(null, 100);
        if (tempFile.exists()) {
          tempFile.delete(true, Policy.subMonitorFor(monitor, 25));
        }
        tempFile.create(stream, true, Policy.subMonitorFor(monitor, 25));
        file.delete(false, true, Policy.subMonitorFor(monitor, 25));
        tempFile.move(new Path(null, file.getName()), false, true, Policy.subMonitorFor(monitor, 25));
        monitor.done();
        break;
      case 3: 
        file.setContents(stream, false, true, monitor);
      }
    }
    catch (CoreException e)
    {
      String message = null;
      if (e.getStatus().getCode() == 271)
      {
        Throwable t = e.getStatus().getException();
        if (t != null) {
          message = t.getMessage();
        }
      }
      if (message == null) {
        message = e.getMessage();
      }
      throw CVSException.wrapException(resource, NLS.bind(CVSMessages.EclipseFile_Problem_writing_resource, new String[] { resource.getFullPath().toString(), message }), e);
    }
  }
  
  public void setReadOnly(boolean readOnly)
    throws CVSException
  {
    ResourceAttributes attributes = resource.getResourceAttributes();
    if (attributes != null)
    {
      attributes.setReadOnly(readOnly);
      try
      {
        resource.setResourceAttributes(attributes);
      }
      catch (CoreException e)
      {
        throw CVSException.wrapException(e);
      }
    }
  }
  
  public boolean isReadOnly()
    throws CVSException
  {
    return getIFile().isReadOnly();
  }
  
  public void setExecutable(boolean executable)
    throws CVSException
  {
    ResourceAttributes attributes = resource.getResourceAttributes();
    if (attributes != null)
    {
      attributes.setExecutable(executable);
      try
      {
        resource.setResourceAttributes(attributes);
      }
      catch (CoreException e)
      {
        throw CVSException.wrapException(e);
      }
    }
  }
  
  public boolean isExecutable()
    throws CVSException
  {
    ResourceAttributes attributes = resource.getResourceAttributes();
    if (attributes != null) {
      return attributes.isExecutable();
    }
    return false;
  }
  
  public IFile getIFile()
  {
    return (IFile)resource;
  }
  
  private File getIOFile()
  {
    IPath location = resource.getLocation();
    if (location != null) {
      return location.toFile();
    }
    return null;
  }
  
  public ILogEntry[] getLogEntries(IProgressMonitor monitor)
    throws TeamException
  {
    if ((getIResource() == null) || 
      (!getIResource().getProject().isAccessible())) {
      return new ILogEntry[0];
    }
    byte[] syncBytes = getSyncBytes();
    if ((syncBytes != null) && (!ResourceSyncInfo.isAddition(syncBytes)))
    {
      ICVSRemoteResource remoteFile = CVSWorkspaceRoot.getRemoteResourceFor(resource);
      if (remoteFile != null) {
        return ((ICVSRemoteFile)remoteFile).getLogEntries(monitor);
      }
    }
    return new ILogEntry[0];
  }
  
  public void setNotifyInfo(NotifyInfo info)
    throws CVSException
  {
    if (isMa
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

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