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

 local, IResourceVariant base, IResourceVariant remote)
    throws TeamException
  {
    CVSSyncInfo info = new CVSSyncInfo(local, base, remote, this);
    info.init();
    return info;
  }
  
  protected boolean getCacheFileContentsHint()
  {
    return false;
  }
  
  protected boolean isThreeWay()
  {
    return true;
  }
  
  protected boolean rootsEqual(Subscriber other)
  {
    Set roots1 = new HashSet(Arrays.asList(other.roots()));
    Set roots2 = new HashSet(Arrays.asList(roots()));
    if (roots1.size() != roots2.size()) {
      return false;
    }
    return roots2.containsAll(roots1);
  }
  
  public IDiff getDiff(IResource resource)
    throws CoreException
  {
    SyncInfo info = getSyncInfo(resource);
    if ((info == null) || (info.getKind() == 0)) {
      return null;
    }
    return converter.getDeltaFor(info);
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == SyncInfoToDiffConverter.class) {
      return converter;
    }
    return Platform.getAdapterManager().getAdapter(this, adapter);
  }
}

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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.core.history.ITag;

public class CVSTag
  implements ITag
{
  public static final int HEAD = 0;
  public static final int BRANCH = 1;
  public static final int VERSION = 2;
  public static final int DATE = 3;
  public static final CVSTag DEFAULT = new CVSTag();
  public static final CVSTag BASE = new CVSTag("BASE", 2);
  public static final String VENDOR_REVISION = "1.1.1";
  public static final String HEAD_REVISION = "1";
  public static final String UNKNOWN_BRANCH = CVSMessages.CVSTag_unknownBranch;
  public static final String HEAD_BRANCH = "HEAD";
  protected String name;
  protected String branchRevision;
  protected int type;
  private static final String DATE_TAG_NAME_FORMAT = "dd MMM yyyy HH:mm:ss Z";
  private static final SimpleDateFormat tagNameFormat = new SimpleDateFormat("dd MMM yyyy HH:mm:ss Z", Locale.US);
  
  protected static synchronized String dateToTagName(Date date)
  {
    tagNameFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
    return tagNameFormat.format(date);
  }
  
  protected static synchronized Date tagNameToDate(String name)
  {
    if (name == null) {
      return null;
    }
    try
    {
      return tagNameFormat.parse(name);
    }
    catch (ParseException e)
    {
      IStatus status = new CVSStatus(4, 4, "Tag name " + name + " is not of the expected format " + "dd MMM yyyy HH:mm:ss Z", e);
      CVSProviderPlugin.log(new CVSException(status));
    }
    return null;
  }
  
  public CVSTag()
  {
    this("HEAD", "1", 0);
  }
  
  public CVSTag(String name, int type)
  {
    this.name = name;
    this.type = type;
    branchRevision = null;
  }
  
  public CVSTag(String name, String branchRevision, int type)
  {
    this.name = name;
    this.branchRevision = branchRevision;
    this.type = type;
  }
  
  public CVSTag(Date date)
  {
    this(dateToTagName(date), 3);
  }
  
  public boolean equals(Object other)
  {
    if (other == this) {
      return true;
    }
    if (!(other instanceof CVSTag)) {
      return false;
    }
    CVSTag tag = (CVSTag)other;
    if (getType() != tag.getType()) {
      return false;
    }
    if (!getName().equals(tag.getName())) {
      return false;
    }
    return true;
  }
  
  public String getName()
  {
    return name;
  }
  
  public String getBranchRevision()
  {
    return branchRevision;
  }
  
  public int getType()
  {
    return type;
  }
  
  public int hashCode()
  {
    return name.hashCode();
  }
  
  public int compareTo(CVSTag other)
  {
    if ((getType() == 3) && (other.getType() == 3))
    {
      Date date1 = asDate();
      Date date2 = other.asDate();
      if ((date1 == null) || (date2 == null)) {
        return -1;
      }
      return date1.compareTo(date2);
    }
    return getName().compareToIgnoreCase(other.getName());
  }
  
  public static boolean equalTags(CVSTag tag1, CVSTag tag2)
  {
    if (tag1 == null) {
      tag1 = DEFAULT;
    }
    if (tag2 == null) {
      tag2 = DEFAULT;
    }
    return tag1.equals(tag2);
  }
  
  public static IStatus validateTagName(String tagName)
  {
    if (tagName == null) {
      return new CVSStatus(4, CVSMessages.CVSTag_nullName);
    }
    if (tagName.equals("")) {
      return new CVSStatus(4, CVSMessages.CVSTag_emptyName);
    }
    if (!Character.isLetter(tagName.charAt(0))) {
      return new CVSStatus(4, CVSMessages.CVSTag_beginName);
    }
    for (int i = 0; i < tagName.length(); i++)
    {
      char c = tagName.charAt(i);
      if ((Character.isSpaceChar(c)) || (c == '$') || (c == ',') || (c == '.') || (c == ':') || (c == ';') || (c == '@') || (c == '|')) {
        return new CVSStatus(4, CVSMessages.CVSTag_badCharName);
      }
    }
    return new CVSStatus(0, CVSMessages.ok);
  }
  
  public Date asDate()
  {
    return tagNameToDate(name);
  }
  
  public boolean isHeadTag()
  {
    return (getType() == 0) || ((getType() == 2) && (getName().equals("HEAD")));
  }
  
  public boolean isBaseTag()
  {
    return getName().equals("BASE");
  }
}

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

class CVSTeamProvider$1
  implements ICVSRunnable
{
  final CVSTeamProvider this$0;
  private final String val$root;
  
  CVSTeamProvider$1(CVSTeamProvider paramCVSTeamProvider, String paramString)
  {
    this$0 = paramCVSTeamProvider;val$root = paramString;
  }
  
  /* Error */
  public void run(org.eclipse.core.runtime.IProgressMonitor progress)
    throws CVSException
  {
    // Byte code:
    //   0: aload_1
    //   1: aconst_null
    //   2: bipush 100
    //   4: invokeinterface 66 3 0
    //   9: aload_1
    //   10: bipush 100
    //   12: invokestatic 63	org/eclipse/team/internal/ccvs/core/Policy:infiniteSubMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   15: astore_2
    //   16: aload_2
    //   17: aconst_null
    //   18: sipush 256
    //   21: invokeinterface 66 3 0
    //   26: aload_0
    //   27: getfield 59	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$1:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
    //   30: invokestatic 61	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$0	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;)Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   33: invokevirtual 64	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getLocalRoot	()Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
    //   36: new 31	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$2
    //   39: dup
    //   40: aload_0
    //   41: aload_2
    //   42: aload_0
    //   43: getfield 58	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$1:val$root	Ljava/lang/String;
    //   46: invokespecial 62	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$2:<init>	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider$1;Lorg/eclipse/core/runtime/IProgressMonitor;Ljava/lang/String;)V
    //   49: invokeinterface 67 2 0
    //   54: goto +12 -> 66
    //   57: astore_3
    //   58: aload_1
    //   59: invokeinterface 65 1 0
    //   64: aload_3
    //   65: athrow
    //   66: aload_1
    //   67: invokeinterface 65 1 0
    //   72: return
    // Line number table:
    //   Java source line #239	-> byte code offset #0
    //   Java source line #240	-> byte code offset #9
    //   Java source line #241	-> byte code offset #16
    //   Java source line #244	-> byte code offset #26
    //   Java source line #258	-> byte code offset #57
    //   Java source line #259	-> byte code offset #58
    //   Java source line #260	-> byte code offset #64
    //   Java source line #259	-> byte code offset #66
    //   Java source line #261	-> byte code offset #72
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	73	0	this	1
    //   0	73	1	progress	org.eclipse.core.runtime.IProgressMonitor
    //   15	27	2	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   57	8	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	57	57	finally
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableFolderSyncInfo;

class CVSTeamProvider$2
  implements ICVSResourceVisitor
{
  final CVSTeamProvider.1 this$1;
  private final IProgressMonitor val$monitor;
  private final String val$root;
  
  CVSTeamProvider$2(CVSTeamProvider.1 param1, IProgressMonitor paramIProgressMonitor, String paramString)
  {
    this$1 = param1;val$monitor = paramIProgressMonitor;val$root = paramString;
  }
  
  public void visitFile(ICVSFile file)
    throws CVSException
  {}
  
  public void visitFolder(ICVSFolder folder)
    throws CVSException
  {
    val$monitor.worked(1);
    FolderSyncInfo info = folder.getFolderSyncInfo();
    if (info != null)
    {
      val$monitor.subTask(NLS.bind(CVSMessages.CVSTeamProvider_updatingFolder, new String[] { info.getRepository() }));
      MutableFolderSyncInfo newInfo = info.cloneMutable();
      newInfo.setRoot(val$root);
      folder.setFolderSyncInfo(newInfo);
      folder.acceptChildren(this);
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.team.internal.ccvs.core.client.Admin;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.Commit;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.listeners.AdminKSubstListener;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

class CVSTeamProvider$3
  implements ICVSRunnable
{
  final CVSTeamProvider this$0;
  private final Map val$changeSet;
  private final String val$comment;
  private final IStatus[] val$result;
  
  CVSTeamProvider$3(CVSTeamProvider paramCVSTeamProvider, Map paramMap, String paramString, IStatus[] paramArrayOfIStatus)
  {
    this$0 = paramCVSTeamProvider;val$changeSet = paramMap;val$comment = paramString;val$result = paramArrayOfIStatus;
  }
  
  public void run(IProgressMonitor monitor)
    throws CVSException
  {
    Map filesToAdmin = new HashMap();
    Collection filesToCommitAsText = new HashSet();
    boolean useCRLF = (CVSTeamProvider.access$1()) && (CVSProviderPlugin.getPlugin().isUsePlatformLineend());
    for (Iterator it = val$changeSet.entrySet().iterator(); it.hasNext();)
    {
      Map.Entry entry = (Map.Entry)it.next();
      IFile file = (IFile)entry.getKey();
      toKSubst = (Command.KSubstOption)entry.getValue();
      
      CVSTeamProvider.access$2(this$0, file);
      ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(file);
      if (mFile.isManaged())
      {
        byte[] syncBytes = mFile.getSyncBytes();
        fromKSubst = ResourceSyncInfo.getKeywordMode(syncBytes);
        if (!toKSubst.equals(fromKSubst)) {
          if (ResourceSyncInfo.isAddition(syncBytes))
          {
            mFile.setSyncBytes(ResourceSyncInfo.setKeywordMode(syncBytes, toKSubst), 0);
          }
          else if (!ResourceSyncInfo.isDeletion(syncBytes))
          {
            if ((fromKSubst.isBinary()) && (!toKSubst.isBinary()))
            {
              CVSTeamProvider.cleanLineDelimiters(file, useCRLF, new NullProgressMonitor());
              
              filesToCommitAsText.add(mFile);
            }
            list = (List)filesToAdmin.get(toKSubst);
            if (list == null)
            {
              list = new ArrayList();
              filesToAdmin.put(toKSubst, list);
            }
            list.add(mFile);
          }
        }
      }
    }
    int totalWork = filesToCommitAsText.size() + 1;
    for (Iterator it = filesToAdmin.values().iterator(); it.hasNext();)
    {
      List list = (List)it.next();
      totalWork += list.size();
      totalWork++;
    }
    if (totalWork != 0)
    {
      monitor.beginTask(CVSMessages.CVSTeamProvider_settingKSubst, totalWork);
      try
      {
        if (filesToCommitAsText.size() != 0)
        {
          Session session = new Session(CVSTeamProvider.access$0(this$0).getRemoteLocation(), CVSTeamProvider.access$0(this$0).getLocalRoot(), true);
          session.open(Policy.subMonitorFor(monitor, 1), true);
          try
          {
            String keywordChangeComment = val$comment;
            if ((keywordChangeComment == null) || (keywordChangeComment.length() == 0)) {
              keywordChangeComment = CVSMessages.CVSTeamProvider_changingKeywordComment;
            }
            val$result[0] = Command.COMMIT.execute(
              session, 
              Command.NO_GLOBAL_OPTIONS, 
              new Command.LocalOption[] { Command.DO_NOT_RECURSE, Commit.FORCE, 
              Command.makeArgumentOption(Command.MESSAGE_OPTION, keywordChangeComment) }, 
              (ICVSResource[])filesToCommitAsText.toArray(new ICVSResource[filesToCommitAsText.size()]), 
              filesToCommitAsText, 
              null, 
              Policy.subMonitorFor(monitor, filesToCommitAsText.size()));
          }
          finally
          {
            session.close();
          }
          if (!val$result[0].isOK()) {
            return;
          }
        }
        for (Iterator it = filesToAdmin.entrySet().iterator(); it.hasNext();)
        {
          Map.Entry entry = (Map.Entry)it.next();
          Command.KSubstOption toKSubst = (Command.KSubstOption)entry.getKey();
          List list = (List)entry.getValue();
          
          Session session = new Session(CVSTeamProvider.access$0(this$0).getRemoteLocation(), CVSTeamProvider.access$0(this$0).getLocalRoot(), true);
          session.open(Policy.subMonitorFor(monitor, 1), true);
          try
          {
            val$result[0] = Command.ADMIN.execute(
              session, 
              Command.NO_GLOBAL_OPTIONS, 
              new Command.LocalOption[] { toKSubst }, 
              (ICVSResource[])list.toArray(new ICVSResource[list.size()]), 
              new AdminKSubstListener(toKSubst), 
              Policy.subMonitorFor(monitor, list.size()));
          }
          finally
          {
            session.close();
          }
          if (!val$result[0].isOK()) {
            return;
          }
        }
      }
      finally
      {
        monitor.done();
      }
      monitor.done();
    }
  }
}

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

class CVSTeamProvider$4
  implements ICVSResourceVisitor
{
  final CVSTeamProvider this$0;
  private final boolean val$notifyForWritable;
  private final int val$notify;
  
  CVSTeamProvider$4(CVSTeamProvider paramCVSTeamProvider, boolean paramBoolean, int paramInt)
  {
    this$0 = paramCVSTeamProvider;val$notifyForWritable = paramBoolean;val$notify = paramInt;
  }
  
  public void visitFile(ICVSFile file)
    throws CVSException
  {
    if ((val$notifyForWritable) || (file.isReadOnly())) {
      file.edit(val$notify, val$notifyForWritable, Policy.monitorFor(null));
    }
  }
  
  public void visitFolder(ICVSFolder folder)
    throws CVSException
  {}
}

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

class CVSTeamProvider$5
  implements ICVSResourceVisitor
{
  final CVSTeamProvider this$0;
  
  CVSTeamProvider$5(CVSTeamProvider paramCVSTeamProvider)
  {
    this$0 = paramCVSTeamProvider;
  }
  
  public void visitFile(ICVSFile file)
    throws CVSException
  {
    if (!file.isReadOnly()) {
      file.unedit(Policy.monitorFor(null));
    }
  }
  
  public void visitFolder(ICVSFolder folder)
    throws CVSException
  {}
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRunnable;

class CVSTeamProvider$6
  implements IWorkspaceRunnable
{
  final CVSTeamProvider this$0;
  private final IResource[] val$resources;
  private final ICVSResourceVisitor val$editUneditVisitor;
  private final boolean val$recurse;
  private final CVSException[] val$exception;
  private final boolean val$notifyServer;
  
  CVSTeamProvider$6(CVSTeamProvider paramCVSTeamProvider, IResource[] paramArrayOfIResource, ICVSResourceVisitor paramICVSResourceVisitor, boolean paramBoolean1, CVSException[] paramArrayOfCVSException, boolean paramBoolean2)
  {
    this$0 = paramCVSTeamProvider;val$resources = paramArrayOfIResource;val$editUneditVisitor = paramICVSResourceVisitor;val$recurse = paramBoolean1;val$exception = paramArrayOfCVSException;val$notifyServer = paramBoolean2;
  }
  
  /* Error */
  public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
    throws org.eclipse.core.runtime.CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 113	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
    //   4: aload_0
    //   5: getfield 111	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$resources	[Lorg/eclipse/core/resources/IResource;
    //   8: invokestatic 120	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$3	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;[Lorg/eclipse/core/resources/IResource;)[Lorg/eclipse/team/internal/ccvs/core/ICVSResource;
    //   11: astore_2
    //   12: iconst_0
    //   13: istore_3
    //   14: goto +22 -> 36
    //   17: aload_2
    //   18: iload_3
    //   19: aaload
    //   20: aload_0
    //   21: getfield 114	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$editUneditVisitor	Lorg/eclipse/team/internal/ccvs/core/ICVSResourceVisitor;
    //   24: aload_0
    //   25: getfield 110	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$recurse	Z
    //   28: invokeinterface 130 3 0
    //   33: iinc 3 1
    //   36: iload_3
    //   37: aload_2
    //   38: arraylength
    //   39: if_icmplt -22 -> 17
    //   42: goto +12 -> 54
    //   45: astore_3
    //   46: aload_0
    //   47: getfield 112	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$exception	[Lorg/eclipse/team/internal/ccvs/core/CVSException;
    //   50: iconst_0
    //   51: aload_3
    //   52: aastore
    //   53: return
    //   54: aload_0
    //   55: getfield 109	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$notifyServer	Z
    //   58: ifeq +140 -> 198
    //   61: aload_1
    //   62: aconst_null
    //   63: bipush 100
    //   65: invokeinterface 129 3 0
    //   70: new 64	org/eclipse/team/internal/ccvs/core/client/Session
    //   73: dup
    //   74: aload_0
    //   75: getfield 113	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
    //   78: invokestatic 119	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$0	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;)Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   81: invokevirtual 127	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getRemoteLocation	()Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;
    //   84: aload_0
    //   85: getfield 113	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:this$0	Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;
    //   88: invokestatic 119	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:access$0	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;)Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   91: invokevirtual 126	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getLocalRoot	()Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
    //   94: iconst_1
    //   95: invokespecial 125	org/eclipse/team/internal/ccvs/core/client/Session:<init>	(Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;Z)V
    //   98: astore_3
    //   99: aload_3
    //   100: aload_1
    //   101: bipush 10
    //   103: invokestatic 121	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   106: iconst_1
    //   107: invokevirtual 124	org/eclipse/team/internal/ccvs/core/client/Session:open	(Lorg/eclipse/core/runtime/IProgressMonitor;Z)V
    //   110: goto +15 -> 125
    //   113: pop
    //   114: aload_3
    //   115: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   118: aload_1
    //   119: invokeinterface 128 1 0
    //   124: return
    //   125: getstatic 117	org/eclipse/team/internal/ccvs/core/client/Command:NOOP	Lorg/eclipse/team/internal/ccvs/core/client/NOOPCommand;
    //   128: aload_3
    //   129: getstatic 115	org/eclipse/team/internal/ccvs/core/client/Command:NO_GLOBAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$GlobalOption;
    //   132: getstatic 116	org/eclipse/team/internal/ccvs/core/client/Command:NO_LOCAL_OPTIONS	[Lorg/eclipse/team/internal/ccvs/core/client/Command$LocalOption;
    //   135: aload_2
    //   136: aconst_null
    //   137: aload_1
    //   138: bipush 90
    //   140: invokestatic 121	org/eclipse/team/internal/ccvs/core/Policy:subMonitorFor	(Lorg/eclipse/core/runtime/IProgressMonitor;I)Lorg/eclipse/core/runtime/IProgressMonitor;
    //   143: invokevirtual 122	org/eclipse/team/internal/ccvs/core/client/NOOPCommand: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;
    //   146: pop
    //   147: goto +41 -> 188
    //   150: astore 4
    //   152: aload_0
    //   153: getfield 112	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$6:val$exception	[Lorg/eclipse/team/internal/ccvs/core/CVSException;
    //   156: iconst_0
    //   157: aload 4
    //   159: aastore
    //   160: aload_3
    //   161: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   164: aload_1
    //   165: invokeinterface 128 1 0
    //   170: goto +28 -> 198
    //   173: astore 5
    //   175: aload_3
    //   176: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   179: aload_1
    //   180: invokeinterface 128 1 0
    //   185: aload 5
    //   187: athrow
    //   188: aload_3
    //   189: invokevirtual 123	org/eclipse/team/internal/ccvs/core/client/Session:close	()V
    //   192: aload_1
    //   193: invokeinterface 128 1 0
    //   198: return
    // Line number table:
    //   Java source line #581	-> byte code offset #0
    //   Java source line #585	-> byte code offset #12
    //   Java source line #586	-> byte code offset #17
    //   Java source line #585	-> byte code offset #33
    //   Java source line #588	-> byte code offset #45
    //   Java source line #589	-> byte code offset #46
    //   Java source line #590	-> byte code offset #53
    //   Java source line #594	-> byte code offset #54
    //   Java source line #595	-> byte code offset #61
    //   Java source line #596	-> byte code offset #70
    //   Java source line #599	-> byte code offset #99
    //   Java source line #600	-> byte code offset #113
    //   Java source line #615	-> byte code offset #114
    //   Java source line #616	-> byte code offset #118
    //   Java source line #603	-> byte code offset #124
    //   Java source line #605	-> byte code offset #125
    //   Java source line #606	-> byte code offset #128
    //   Java source line #607	-> byte code offset #129
    //   Java source line #608	-> byte code offset #132
    //   Java source line #609	-> byte code offset #135
    //   Java source line #610	-> byte code offset #136
    //   Java source line #611	-> byte code offset #137
    //   Java source line #605	-> byte code offset #143
    //   Java source line #612	-> byte code offset #150
    //   Java source line #613	-> byte code offset #152
    //   Java source line #615	-> byte code offset #160
    //   Java source line #616	-> byte code offset #164
    //   Java source line #614	-> byte code offset #173
    //   Java source line #615	-> byte code offset #175
    //   Java source line #616	-> byte code offset #179
    //   Java source line #617	-> byte code offset #185
    //   Java source line #615	-> byte code offset #188
    //   Java source line #616	-> byte code offset #192
    //   Java source line #619	-> byte code offset #198
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	199	0	this	6
    //   0	199	1	monitor	org.eclipse.core.runtime.IProgressMonitor
    //   11	125	2	cvsResources	ICVSResource[]
    //   13	24	3	i	int
    //   45	7	3	e	CVSException
    //   98	91	3	session	org.eclipse.team.internal.ccvs.core.client.Session
    //   150	8	4	e	CVSException
    //   173	13	5	localObject	Object
    //   113	1	8	localCVSException1	CVSException
    // Exception table:
    //   from	to	target	type
    //   12	42	45	org/eclipse/team/internal/ccvs/core/CVSException
    //   99	110	113	org/eclipse/team/internal/ccvs/core/CVSException
    //   99	114	150	org/eclipse/team/internal/ccvs/core/CVSException
    //   125	147	150	org/eclipse/team/internal/ccvs/core/CVSException
    //   99	114	173	finally
    //   125	160	173	finally
  }
}

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

import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFileModificationValidator;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceRuleFactory;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.team.FileModificationValidator;
import org.eclipse.core.resources.team.IMoveDeleteHook;
import org.eclipse.core.resources.team.ResourceRuleFactory;
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.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.history.IFileHistoryProvider;
import org.eclipse.team.internal.ccvs.core.client.Admin;
import org.eclipse.team.internal.ccvs.core.client.Command;
import org.eclipse.team.internal.ccvs.core.client.Command.KSubstOption;
import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
import org.eclipse.team.internal.ccvs.core.client.Commit;
import org.eclipse.team.internal.ccvs.core.client.Session;
import org.eclipse.team.internal.ccvs.core.client.listeners.AdminKSubstListener;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileHistoryProvider;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.MoveDeleteHook;
import org.eclipse.team.internal.ccvs.core.util.ResourceStateChangeListeners;
import org.eclipse.team.internal.ccvs.core.util.SyncFileWriter;

public class CVSTeamProvider
  extends RepositoryProvider
{
  private static final ResourceRuleFactory RESOURCE_RULE_FACTORY = new CVSResourceRuleFactory();
  private static final boolean IS_CRLF_PLATFORM = Arrays.equals(
    System.getProperty("line.separator").getBytes(), new byte[] { 13, 10 });
  public static final IStatus OK = new Status(0, "org.eclipse.team.cvs.core", 0, CVSMessages.ok, null);
  private CVSWorkspaceRoot workspaceRoot;
  private IProject project;
  private static MoveDeleteHook moveDeleteHook = new MoveDeleteHook();
  private static CVSCoreFileModificationValidator fileModificationValidator;
  private static CVSFileHistoryProvider fileHistoryProvider;
  private static final QualifiedName FETCH_ABSENT_DIRECTORIES_PROP_KEY = new QualifiedName("org.eclipse.team.cvs.core", "fetch_absent_directories");
  private static final QualifiedName WATCH_EDIT_PROP_KEY = new QualifiedName("org.eclipse.team.cvs.core", "watch_edit");
  private static final QualifiedName TEMP_SHARED = new QualifiedName("org.eclipse.team.cvs.core", "tempShare");
  
  public static boolean isSharedWithCVS(IProject project)
  {
    if (project.isAccessible())
    {
      if (RepositoryProvider.isShared(project))
      {
        RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId());
        if (provider != null) {
          return true;
        }
      }
      try
      {
        Object sessionProperty = project.getSessionProperty(TEMP_SHARED);
        return (sessionProperty != null) && (sessionProperty.equals(Boolean.TRUE));
      }
      catch (CoreException e)
      {
        CVSProviderPlugin.log(e);
      }
    }
    return false;
  }
  
  public static void markAsTempShare(IProject project)
  {
    if (RepositoryProvider.isShared(project)) {
      return;
    }
    try
    {
      project.setSessionProperty(TEMP_SHARED, Boolean.TRUE);
    }
    catch (CoreException e)
    {
      CVSProviderPlugin.log(e);
    }
  }
  
  protected static CVSCoreFileModificationValidator internalGetFileModificationValidator()
  {
    if (fileModificationValidator == null) {
      fileModificationValidator = new CVSCoreFileModificationValidator();
    }
    return fileModificationValidator;
  }
  
  public void deconfigure() {}
  
  public void deconfigured()
  {
    try
    {
      EclipseSynchronizer.getInstance().deconfigure(getProject(), null);
      internalSetWatchEditEnabled(null);
      internalSetFetchAbsentDirectories(null);
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    ResourceStateChangeListeners.getListener().projectDeconfigured(getProject());
  }
  
  public IProject getProject()
  {
    return project;
  }
  
  public void setProject(IProject project)
  {
    this.project = project;
    workspaceRoot = new CVSWorkspaceRoot(project);
  }
  
  public ICVSRepositoryLocation getRemoteLocation()
    throws CVSException
  {
    try
    {
      return workspaceRoot.getRemoteLocation();
    }
    catch (CVSException e)
    {
      try
      {
        RepositoryProvider.unmap(project);
      }
      catch (TeamException ex)
      {
        CVSProviderPlugin.log(ex);
      }
      throw e;
    }
  }
  
  public CVSWorkspaceRoot getCVSWorkspaceRoot()
  {
    return workspaceRoot;
  }
  
  private void checkIsChild(IResource resource)
    throws CVSException
  {
    if (!isChildResource(resource)) {
      throw new CVSException(new Status(4, "org.eclipse.team.cvs.core", -6, 
        NLS.bind(CVSMessages.CVSTeamProvider_invalidResource, new Object[] { resource.getFullPath().toString(), project.getName() }), 
        null));
    }
  }
  
  private String[] getValidArguments(IResource[] resources, Command.LocalOption[] options)
    throws CVSException
  {
    List arguments = new ArrayList(resources.length);
    for (int i = 0; i < resources.length; i++)
    {
      checkIsChild(resources[i]);
      IPath cvsPath = resources[i].getFullPath().removeFirstSegments(1);
      if (cvsPath.segmentCount() == 0) {
        arguments.add(".");
      } else {
        arguments.add(cvsPath.toString());
      }
    }
    return (String[])arguments.toArray(new String[arguments.size()]);
  }
  
  private ICVSResource[] getCVSArguments(IResource[] resources)
  {
    ICVSResource[] cvsResources = new ICVSResource[resources.length];
    for (int i = 0; i < cvsResources.length; i++) {
      cvsResources[i] = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
    }
    return cvsResources;
  }
  
  /* Error */
  public void setRemoteRoot(ICVSRepositoryLocation location, IProgressMonitor monitor)
    throws TeamException
  {
    // Byte code:
    //   0: aload_1
    //   1: iconst_0
    //   2: invokeinterface 722 2 0
    //   7: astore_3
    //   8: aload_3
    //   9: aload_0
    //   10: getfield 601	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:workspaceRoot	Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   13: invokevirtual 678	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getRemoteLocation	()Lorg/eclipse/team/internal/ccvs/core/ICVSRepositoryLocation;
    //   16: invokevirtual 620	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   19: ifeq +4 -> 23
    //   22: return
    //   23: aload_0
    //   24: getfield 601	org/eclipse/team/internal/ccvs/core/CVSTeamProvider:workspaceRoot	Lorg/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot;
    //   27: invokevirtual 677	org/eclipse/team/internal/ccvs/core/resources/CVSWorkspaceRoot:getLocalRoot	()Lorg/eclipse/team/internal/ccvs/core/ICVSFolder;
    //   30: new 305	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$1
    //   33: dup
    //   34: aload_0
    //   35: aload_3
    //   36: invokespecial 662	org/eclipse/team/internal/ccvs/core/CVSTeamProvider$1:<init>	(Lorg/eclipse/team/internal/ccvs/core/CVSTeamProvider;Ljava/lang/String;)V
    //   39: aload_2
    //   40: invokeinterface 721 3 0
    //   45: goto +14 -> 59
    //   48: astore 4
    //   50: aload_2
    //   51: invokeinterface 712 1 0
    //   56: aload 4
    //   58: athrow
    //   59: aload_2
    //   60: invokeinterface 712 1 0
    //   65: return
    // Line number table:
    //   Java source line #230	-> byte code offset #0
    //   Java source line #231	-> byte code offset #8
    //   Java source line #232	-> byte code offset #22
    //   Java source line #235	-> byte code offset #23
    //   Java source line #262	-> byte code offset #39
    //   Java source line #235	-> byte code offset #40
    //   Java source line #263	-> byte code offset #48
    //   Java source line #264	-> byte code offset #50
    //   Java source line #265	-> byte code offset #56
    //   Java source line #264	-> byte code offset #59
    //   Java source line #266	-> byte code offset #65
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	66	0	this	CVSTeamProvider
    //   0	66	1	location	ICVSRepositoryLocation
    //   0	66	2	monitor	IProgressMonitor
    //   7	29	3	root	String
    //   48	9	4	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   23	48	48	finally
  }
  
  private boolean isChildResource(IResource resource)
  {
    return resource.getProject().getName().equals(project.getName());
  }
  
  public void configureProject()
    throws CoreException
  {
    getProject().setSessionProperty(TEMP_SHARED, null);
    ResourceStateChangeListeners.getListener().projectConfigured(getProject());
  }
  
  public IStatus setKeywordSubstitution(Map changeSet, String comment, IProgressMonitor monitor)
    throws TeamException
  {
    IStatus[] result = { ICommandOutputListener.OK };
    workspaceRoot.getLocalRoot().run(new ICVSRunnable()
    {
      private final Map val$changeSet;
      private final String val$comment;
      private final IStatus[] val$result;
      
      public void run(IProgressMonitor monitor)
        throws CVSException
      {
        Map filesToAdmin = new HashMap();
        Collection filesToCommitAsText = new HashSet();
        boolean useCRLF = (CVSTeamProvider.IS_CRLF_PLATFORM) && (CVSProviderPlugin.getPlugin().isUsePlatformLineend());
        for (Iterator it = val$changeSet.entrySet().iterator(); it.hasNext();)
        {
          Map.Entry entry = (Map.Entry)it.next();
          IFile file = (IFile)entry.getKey();
          toKSubst = (Command.KSubstOption)entry.getValue();
          
          CVSTeamProvider.this.checkIsChild(file);
          ICVSFile mFile = CVSWorkspaceRoot.getCVSFileFor(file);
          if (mFile.isManaged())
          {
            byte[] syncBytes = mFile.getSyncBytes();
            fromKSubst = ResourceSyncInfo.getKeywordMode(syncBytes);
            if (!toKSubst.equals(fromKSubst)) {
              if (ResourceSyncInfo.isAddition(syncBytes))
              {
                mFile.setSyncBytes(ResourceSyncInfo.setKeywordMode(syncBytes, toKSubst), 0);
              }
              else if (!ResourceSyncInfo.isDeletion(syncBytes))
              {
                if ((fromKSubst.isBinary()) && (!toKSubst.isBinary()))
                {
                  CVSTeamProvider.cleanLineDelimiters(file, useCRLF, new NullProgressMonitor());
                  
                  filesToCommitAsText.add(mFile);
                }
                list = (List)filesToAdmin.get(toKSubst);
                if (list == null)
                {
                  list = new ArrayList();
                  filesToAdmin.put(toKSubst, list);
                }
                list.add(mFile);
              }
            }
          }
        }
        int totalWork = filesToCommitAsText.size() + 1;
        for (Iterator it = filesToAdmin.values().iterator(); it.hasNext();)
       
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