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

    //   7	32	2	workspace	IWorkspace
    //   66	7	3	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	66	66	finally
  }
  
  protected void initializeDefaultPluginPreferences()
  {
    org.eclipse.core.runtime.Preferences store = getPluginPreferences();
    store.setDefault("cvs.read.only", false);
    store.setDefault("cvs.watch.on.edit", false);
  }
  
  public String getCvsRshCommand()
  {
    return cvsRshCommand;
  }
  
  public void setCvsRshCommand(String cvsRshCommand)
  {
    this.cvsRshCommand = cvsRshCommand;
  }
  
  public String getCvsRshParameters()
  {
    return cvsRshParameters;
  }
  
  public void setCvsRshParameters(String cvsRshParameters)
  {
    this.cvsRshParameters = cvsRshParameters;
  }
  
  public String getCvsServer()
  {
    return cvsServer;
  }
  
  public void setCvsServer(String cvsServer)
  {
    this.cvsServer = cvsServer;
  }
  
  public boolean getFetchAbsentDirectories()
  {
    return fetchAbsentDirectories;
  }
  
  public boolean getRepositoriesAreBinary()
  {
    return repositoriesAreBinary;
  }
  
  public void setFetchAbsentDirectories(boolean fetchAbsentDirectories)
  {
    this.fetchAbsentDirectories = fetchAbsentDirectories;
  }
  
  public void setRepositoriesAreBinary(boolean binary)
  {
    repositoriesAreBinary = binary;
  }
  
  public static void broadcastDecoratorEnablementChanged(boolean enabled)
  {
    ICVSDecoratorEnablementListener[] listeners;
    synchronized (decoratorEnablementListeners)
    {
      listeners = (ICVSDecoratorEnablementListener[])decoratorEnablementListeners.toArray(new ICVSDecoratorEnablementListener[decoratorEnablementListeners.size()]);
    }
    ICVSDecoratorEnablementListener[] listeners;
    for (int i = 0; i < listeners.length; i++)
    {
      ICVSDecoratorEnablementListener listener = listeners[i];
      ISafeRunnable code = new ISafeRunnable()
      {
        private final boolean val$enabled;
        
        public void run()
          throws Exception
        {
          decoratorEnablementChanged(val$enabled);
        }
        
        public void handleException(Throwable e) {}
      };
      Platform.run(code);
    }
  }
  
  public boolean isReplaceUnmanaged()
  {
    return replaceUnmanaged;
  }
  
  public void setReplaceUnmanaged(boolean replaceUnmanaged)
  {
    this.replaceUnmanaged = replaceUnmanaged;
  }
  
  public void addRepositoryListener(ICVSListener listener)
  {
    KnownRepositories.getInstance().addRepositoryListener(listener);
  }
  
  public void addDecoratorEnablementListener(ICVSDecoratorEnablementListener listener)
  {
    synchronized (decoratorEnablementListeners)
    {
      decoratorEnablementListeners.add(listener);
    }
  }
  
  public void removeRepositoryListener(ICVSListener listener)
  {
    KnownRepositories.getInstance().removeRepositoryListener(listener);
  }
  
  public void removeDecoratorEnablementListener(ICVSDecoratorEnablementListener listener)
  {
    synchronized (decoratorEnablementListeners)
    {
      decoratorEnablementListeners.remove(listener);
    }
  }
  
  public ICVSRepositoryLocation[] getKnownRepositories()
  {
    return KnownRepositories.getInstance().getRepositories();
  }
  
  private void loadOldState()
  {
    try
    {
      IPath pluginStateLocation = getPlugin().getStateLocation().append(".cvsProviderState");
      File file = pluginStateLocation.toFile();
      if (file.exists()) {
        try
        {
          DataInputStream dis = new DataInputStream(new FileInputStream(file));
          readOldState(dis);
          dis.close();
          
          file.delete();
        }
        catch (IOException e)
        {
          throw new TeamException(new Status(4, "org.eclipse.team.cvs.core", -6, CVSMessages.CVSProvider_ioException, e));
        }
      }
    }
    catch (TeamException e)
    {
      Util.logError(CVSMessages.CVSProvider_errorLoading, e);
    }
  }
  
  private void readOldState(DataInputStream dis)
    throws IOException, CVSException
  {
    KnownRepositories instance = KnownRepositories.getInstance();
    int count = dis.readInt();
    if (count >= 0)
    {
      for (int i = 0; i < count; i++)
      {
        ICVSRepositoryLocation location = instance.getRepository(dis.readUTF());
        instance.addRepository(location, false);
      }
    }
    else if (count == -1)
    {
      count = dis.readInt();
      for (int i = 0; i < count; i++)
      {
        ICVSRepositoryLocation location = instance.getRepository(dis.readUTF());
        instance.addRepository(location, false);
        
        dis.readUTF();
      }
    }
    else
    {
      Util.logError(NLS.bind(CVSMessages.CVSProviderPlugin_unknownStateFileVersion, new String[] { new Integer(count).toString() }), null);
    }
  }
  
  public static boolean isText(IFile file)
  {
    if (getPlugin().getRepositoriesAreBinary()) {
      return false;
    }
    return Team.getFileContentManager().getType(file) == 1;
  }
  
  public boolean isDetermineVersionEnabled()
  {
    return determineVersionEnabled;
  }
  
  public void setDetermineVersionEnabled(boolean determineVersionEnabled)
  {
    this.determineVersionEnabled = determineVersionEnabled;
  }
  
  public FileModificationManager getFileModificationManager()
  {
    return fileModificationManager;
  }
  
  public boolean isWatchEditEnabled()
  {
    return getPluginPreferences().getBoolean("cvs.read.only");
  }
  
  public void setDebugProtocol(boolean value)
  {
    Policy.DEBUG_CVS_PROTOCOL = value;
  }
  
  public boolean isDebugProtocol()
  {
    return Policy.DEBUG_CVS_PROTOCOL;
  }
  
  private boolean createCrashFile()
  {
    IPath pluginStateLocation = getPlugin().getStateLocation();
    File crashFile = pluginStateLocation.append(".running").toFile();
    if (crashFile.exists()) {
      return true;
    }
    try
    {
      crashFile.createNewFile();
    }
    catch (IOException e)
    {
      log(4, e.getMessage(), e);
    }
    return false;
  }
  
  private void deleteCrashFile()
  {
    IPath pluginStateLocation = getPlugin().getStateLocation();
    File crashFile = pluginStateLocation.append(".running").toFile();
    crashFile.delete();
  }
  
  public boolean crashOnLastRun()
  {
    return crash;
  }
  
  public org.osgi.service.prefs.Preferences getInstancePreferences()
  {
    return new InstanceScope().getNode(getBundle().getSymbolicName());
  }
  
  public boolean isUsePlatformLineend()
  {
    return usePlatformLineend;
  }
  
  public void setUsePlatformLineend(boolean usePlatformLineend)
  {
    this.usePlatformLineend = usePlatformLineend;
  }
  
  public void setAutoshareOnImport(boolean autoShareOnImport)
  {
    this.autoShareOnImport = autoShareOnImport;
  }
  
  public boolean isAutoshareOnImport()
  {
    return autoShareOnImport;
  }
  
  public boolean isWatchOnEdit()
  {
    return getPluginPreferences().getBoolean("cvs.watch.on.edit");
  }
  
  public void setUseProxy(boolean useProxy)
  {
    this.useProxy = useProxy;
  }
  
  public boolean isUseProxy()
  {
    return useProxy;
  }
  
  public void setProxyType(String proxyType)
  {
    this.proxyType = proxyType;
  }
  
  public String getProxyType()
  {
    return proxyType;
  }
  
  public void setProxyHost(String proxyHost)
  {
    this.proxyHost = proxyHost;
  }
  
  public String getProxyHost()
  {
    return proxyHost;
  }
  
  public void setProxyPort(String proxyPort)
  {
    this.proxyPort = proxyPort;
  }
  
  public String getProxyPort()
  {
    return proxyPort;
  }
  
  public void setUseProxyAuth(boolean useProxyAuth)
  {
    this.useProxyAuth = useProxyAuth;
  }
  
  public boolean isUseProxyAuth()
  {
    return useProxyAuth;
  }
  
  public String getProxyUser()
  {
    Object user = getAuthInfo().get("org.eclipse.team.cvs.core.proxy.user");
    return user == null ? "" : (String)user;
  }
  
  public String getProxyPassword()
  {
    Object pass = getAuthInfo().get("org.eclipse.team.cvs.core.proxy.pass");
    return pass == null ? "" : (String)pass;
  }
  
  private Map getAuthInfo()
  {
    Map authInfo = Platform.getAuthorizationInfo(FAKE_URL, "proxy", "");
    return authInfo != null ? authInfo : Collections.EMPTY_MAP;
  }
  
  public void setProxyAuth(String proxyUser, String proxyPass)
  {
    Map authInfo = getAuthInfo();
    if (authInfo.size() == 0) {
      authInfo = new HashMap(4);
    }
    if (proxyUser != null) {
      authInfo.put("org.eclipse.team.cvs.core.proxy.user", proxyUser);
    }
    if (proxyPass != null) {
      authInfo.put("org.eclipse.team.cvs.core.proxy.pass", proxyPass);
    }
    try
    {
      Platform.addAuthorizationInfo(FAKE_URL, "proxy", "", authInfo);
    }
    catch (CoreException e)
    {
      log(e);
    }
  }
  
  public synchronized ActiveChangeSetManager getChangeSetManager()
  {
    if (changeSetManager == null) {
      changeSetManager = new CVSActiveChangeSetCollector(getPlugin().getCVSWorkspaceSubscriber());
    }
    return changeSetManager;
  }
  
  public IJSchService getJSchService()
  {
    return (IJSchService)tracker.getService();
  }
}

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

import java.util.Comparator;

class CVSRepositoryLocationMatcher$1
  implements Comparator
{
  public int compare(Object o1, Object o2)
  {
    if (((o1 instanceof ICVSRepositoryLocation)) && 
      ((o2 instanceof ICVSRepositoryLocation)))
    {
      ICVSRepositoryLocation rl1 = (ICVSRepositoryLocation)o1;
      ICVSRepositoryLocation rl2 = (ICVSRepositoryLocation)o2;
      String name1 = rl1.getMethod().getName();
      String name2 = rl2.getMethod().getName();
      if ((!name1.equals(name2)) && (CVSRepositoryLocationMatcher.isCompatible(rl1, rl2, false)))
      {
        if (name1.equals("extssh")) {
          return -1;
        }
        if (name2.equals("extssh")) {
          return 1;
        }
        if (name1.equals("pserver")) {
          return -1;
        }
        if (name2.equals("pserver")) {
          return 1;
        }
        if (name1.equals("ext")) {
          return -1;
        }
        if (name2.equals("ext")) {
          return 1;
        }
      }
      return name1.compareTo(name2);
    }
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.CVSRepositoryLocationMatcher.1
 * 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.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IProject;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;

public class CVSRepositoryLocationMatcher
{
  private static final String EXTSSH = "extssh";
  private static final String PSERVER = "pserver";
  private static final String EXT = "ext";
  private static Comparator COMPATIBLE_LOCATIONS_COMPARATOR = new Comparator()
  {
    public int compare(Object o1, Object o2)
    {
      if (((o1 instanceof ICVSRepositoryLocation)) && 
        ((o2 instanceof ICVSRepositoryLocation)))
      {
        ICVSRepositoryLocation rl1 = (ICVSRepositoryLocation)o1;
        ICVSRepositoryLocation rl2 = (ICVSRepositoryLocation)o2;
        String name1 = rl1.getMethod().getName();
        String name2 = rl2.getMethod().getName();
        if ((!name1.equals(name2)) && (CVSRepositoryLocationMatcher.isCompatible(rl1, rl2, false)))
        {
          if (name1.equals("extssh")) {
            return -1;
          }
          if (name2.equals("extssh")) {
            return 1;
          }
          if (name1.equals("pserver")) {
            return -1;
          }
          if (name2.equals("pserver")) {
            return 1;
          }
          if (name1.equals("ext")) {
            return -1;
          }
          if (name2.equals("ext")) {
            return 1;
          }
        }
        return name1.compareTo(name2);
      }
      return 0;
    }
  };
  
  public static Map prepareSuggestedRepositoryLocations(IProject[] projects, Map infoMap)
  {
    List confirmedProjectsList = Arrays.asList(projects);
    Set projectSetRepositoryLocations = new HashSet();
    for (Iterator i = infoMap.keySet().iterator(); i.hasNext();)
    {
      IProject project = (IProject)i.next();
      if (confirmedProjectsList.contains(project))
      {
        CVSProjectSetCapability.LoadInfo loadInfo = (CVSProjectSetCapability.LoadInfo)infoMap.get(project);
        projectSetRepositoryLocations.add(repositoryLocation);
      }
    }
    if (projectSetRepositoryLocations.isEmpty()) {
      return null;
    }
    List knownRepositories = 
      Arrays.asList(KnownRepositories.getInstance().getRepositories());
    if (knownRepositories.isEmpty())
    {
      Map result = new HashMap();
      for (Iterator i = projectSetRepositoryLocations.iterator(); i
            .hasNext();)
      {
        ICVSRepositoryLocation projectSetRepositoryLocation = (ICVSRepositoryLocation)i
          .next();
        ArrayList list = new ArrayList(1);
        list.add(projectSetRepositoryLocation);
        result.put(projectSetRepositoryLocation, list);
      }
      return result;
    }
    if (knownRepositories.containsAll(projectSetRepositoryLocations)) {
      return Collections.EMPTY_MAP;
    }
    Map result = new HashMap();
    for (Iterator i = projectSetRepositoryLocations.iterator(); i
          .hasNext();)
    {
      ICVSRepositoryLocation projectSetRepositoryLocation = (ICVSRepositoryLocation)i
        .next();
      
      List matching = new ArrayList();
      List compatible = new ArrayList();
      List list = new ArrayList();
      for (Iterator j = knownRepositories.iterator(); j.hasNext();)
      {
        ICVSRepositoryLocation knownRepositoryLocation = (ICVSRepositoryLocation)j
          .next();
        if (isMatching(
          projectSetRepositoryLocation, 
          knownRepositoryLocation)) {
          matching.add(knownRepositoryLocation);
        } else if (isCompatible(
          knownRepositoryLocation, 
          projectSetRepositoryLocation, false)) {
          compatible.add(knownRepositoryLocation);
        } else {
          list.add(knownRepositoryLocation);
        }
      }
      Collections.sort(compatible, COMPATIBLE_LOCATIONS_COMPARATOR);
      
      list.addAll(0, compatible);
      if (matching.isEmpty())
      {
        list.add(0, projectSetRepositoryLocation);
      }
      else
      {
        if (matching.size() == 1)
        {
          list.clear();
          list.addAll(matching);
          result.put(projectSetRepositoryLocation, list);
          continue;
        }
        list.addAll(0, matching);
      }
      result.put(projectSetRepositoryLocation, list);
    }
    return result;
  }
  
  public static boolean isCompatible(ICVSRepositoryLocation location1, ICVSRepositoryLocation location2, boolean equalIsCompatible)
  {
    if (!location1.getHost().equals(location2.getHost())) {
      return false;
    }
    if (!location1.getRootDirectory().equals(location2.getRootDirectory())) {
      return false;
    }
    if ((!equalIsCompatible) && (location1.equals(location2))) {
      return false;
    }
    return true;
  }
  
  public static boolean isMatching(ICVSRepositoryLocation location1, ICVSRepositoryLocation location2)
  {
    if ((isCompatible(location1, location2, true)) && 
      (location2.getMethod() == location1.getMethod()) && 
      (location2.getPort() == location1.getPort())) {
      return true;
    }
    return false;
  }
  
  static boolean isPromptRequired(Map suggestedRepositoryLocations)
  {
    if (suggestedRepositoryLocations == null) {
      return false;
    }
    for (Iterator i = suggestedRepositoryLocations.values().iterator(); i
          .hasNext();)
    {
      List list = (List)i.next();
      if (!list.isEmpty()) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.CVSRepositoryLocationMatcher
 * 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.team.ResourceRuleFactory;
import org.eclipse.core.runtime.jobs.ISchedulingRule;

public class CVSResourceRuleFactory
  extends ResourceRuleFactory
{
  public ISchedulingRule validateEditRule(IResource[] resources)
  {
    return CVSTeamProvider.internalGetFileModificationValidator().validateEditRule(this, resources);
  }
  
  public ISchedulingRule getParent(IResource resource)
  {
    return parent(resource);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.CVSResourceRuleFactory
 * 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.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.core.variants.IResourceVariantComparator;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

public class CVSRevisionNumberCompareCriteria
  implements IResourceVariantComparator
{
  private boolean isThreeWay;
  
  public CVSRevisionNumberCompareCriteria(boolean isThreeWay)
  {
    this.isThreeWay = isThreeWay;
  }
  
  protected boolean compare(ICVSRemoteResource e1, ICVSRemoteResource e2)
  {
    if (e1.isContainer())
    {
      if (e2.isContainer()) {
        return true;
      }
      return false;
    }
    return e1.equals(e2);
  }
  
  protected boolean compare(IResource e1, ICVSRemoteResource e2)
  {
    if (e1.getType() != 1)
    {
      if (e2.isContainer()) {
        return true;
      }
      return false;
    }
    ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor((IFile)e1);
    try
    {
      byte[] syncBytes1 = cvsFile.getSyncBytes();
      byte[] syncBytes2 = ((ICVSRemoteFile)e2).getSyncBytes();
      if (syncBytes1 != null)
      {
        if ((ResourceSyncInfo.isDeletion(syncBytes1)) || (ResourceSyncInfo.isMerge(syncBytes1)) || (cvsFile.isModified(null))) {
          return false;
        }
        return ResourceSyncInfo.getRevision(syncBytes1).equals(ResourceSyncInfo.getRevision(syncBytes2));
      }
      return false;
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    return false;
  }
  
  public boolean compare(IResource local, IResourceVariant remote)
  {
    return compare(local, (ICVSRemoteResource)remote);
  }
  
  public boolean compare(IResourceVariant base, IResourceVariant remote)
  {
    return compare((ICVSRemoteResource)base, (ICVSRemoteResource)remote);
  }
  
  public boolean isThreeWay()
  {
    return isThreeWay;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.CVSRevisionNumberCompareCriteria
 * 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.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamStatus;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.KnownRepositories;

public class CVSStatus
  extends TeamStatus
{
  public static final int SERVER_ERROR = -10;
  public static final int NO_SUCH_TAG = -11;
  public static final int CONFLICT = -12;
  public static final int ERROR_LINE = -14;
  public static final int TAG_ALREADY_EXISTS = -15;
  public static final int COMMITTING_SYNC_INFO_FAILED = -16;
  public static final int DOES_NOT_EXIST = -17;
  public static final int FOLDER_NEEDED_FOR_FILE_DELETIONS = -18;
  public static final int CASE_VARIANT_EXISTS = -19;
  public static final int UNSUPPORTED_SERVER_VERSION = -20;
  public static final int SERVER_IS_CVSNT = -21;
  public static final int SERVER_IS_UNKNOWN = -22;
  public static final int PROTOCOL_ERROR = -23;
  public static final int ERROR_LINE_PARSE_FAILURE = -24;
  public static final int FAILED_TO_CACHE_SYNC_INFO = -25;
  public static final int UNMEGERED_BINARY_CONFLICT = -26;
  public static final int INVALID_LOCAL_RESOURCE_PATH = -27;
  public static final int RESPONSE_HANDLING_FAILURE = -28;
  public static final int COMMUNICATION_FAILURE = -29;
  public static final int AUTHENTICATION_FAILURE = -30;
  public static final int BINARY_FILES_DIFFER = -31;
  private ICVSFolder commandRoot;
  private ICVSRepositoryLocation cvsLocation;
  
  public CVSStatus(int severity, int code, String message, Throwable t, ICVSRepositoryLocation cvsLocation)
  {
    super(severity, "org.eclipse.team.cvs.core", code, message, t, null);
    this.cvsLocation = cvsLocation;
  }
  
  public CVSStatus(int severity, int code, String message, ICVSRepositoryLocation cvsLocation)
  {
    this(severity, code, message, null, cvsLocation);
  }
  
  public CVSStatus(int severity, int code, String message, Throwable t, IResource cvsResource)
  {
    super(severity, "org.eclipse.team.cvs.core", code, message, t, cvsResource);
  }
  
  public CVSStatus(int severity, int code, String message, IResource resource)
  {
    this(severity, code, message, null, resource);
  }
  
  public CVSStatus(int severity, int code, String message, Throwable t, ICVSFolder commandRoot)
  {
    super(severity, "org.eclipse.team.cvs.core", code, message, t, null);
    this.commandRoot = commandRoot;
  }
  
  public CVSStatus(int severity, int code, String message, ICVSFolder commandRoot)
  {
    this(severity, code, message, null, commandRoot);
  }
  
  public CVSStatus(int severity, int code, String message, Throwable t)
  {
    super(severity, "org.eclipse.team.cvs.core", code, message, t, null);
  }
  
  public CVSStatus(int severity, String message, Throwable t)
  {
    super(severity, "org.eclipse.team.cvs.core", 4, message, t, null);
  }
  
  public CVSStatus(int severity, String message)
  {
    super(severity, "org.eclipse.team.cvs.core", 4, message, null, null);
  }
  
  public String getMessage()
  {
    String message = super.getMessage();
    if (commandRoot != null) {
      message = NLS.bind(CVSMessages.CVSStatus_messageWithRoot, new String[] { commandRoot.getName(), message });
    }
    return message;
  }
  
  public boolean isInternalError()
  {
    Throwable ex = getException();
    if ((ex instanceof CVSException))
    {
      CVSException cvsEx = (CVSException)ex;
      IStatus status = cvsEx.getStatus();
      return isInternalError(status);
    }
    return ex != null;
  }
  
  public static boolean isInternalError(IStatus status)
  {
    if ((status instanceof CVSStatus)) {
      return ((CVSStatus)status).isInternalError();
    }
    if (status.isMultiStatus())
    {
      IStatus[] children = status.getChildren();
      for (int i = 0; i < children.length; i++)
      {
        IStatus child = children[i];
        if (isInternalError(child)) {
          return true;
        }
      }
      return false;
    }
    return true;
  }
  
  public ICVSRepositoryLocation getCvsLocation()
  {
    if (cvsLocation == null) {
      try
      {
        if (commandRoot != null)
        {
          FolderSyncInfo info = commandRoot.getFolderSyncInfo();
          if (info != null)
          {
            String repoString = info.getRoot();
            cvsLocation = KnownRepositories.getInstance().getRepository(repoString);
          }
        }
        else if (getResource() != null)
        {
          ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(getResource().getProject());
          FolderSyncInfo info = folder.getFolderSyncInfo();
          if (info != null)
          {
            String repoString = info.getRoot();
            cvsLocation = KnownRepositories.getInstance().getRepository(repoString);
          }
        }
      }
      catch (CVSException localCVSException) {}
    }
    return cvsLocation;
  }
  
  public ICVSFolder getCommandRoot()
  {
    return commandRoot;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.team.internal.ccvs.core.CVSStatus
 * 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.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IStorage;
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.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.core.variants.ResourceVariantTreeSubscriber;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.resources.RemoteFolder;
import org.eclipse.team.internal.ccvs.core.resources.RemoteResource;
import org.eclipse.team.internal.ccvs.core.syncinfo.DeferredResourceChangeHandler;
import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableFolderSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.MutableResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.SyncFileChangeListener;

public class CVSSyncInfo
  extends SyncInfo
{
  private static final int INVALID_RESOURCE_TYPE = 1;
  private static final int INVALID_SYNC_KIND = 2;
  private static final int PARENT_NOT_MANAGED = 3;
  private static final int REMOTE_DOES_NOT_EXIST = 4;
  private static final int SYNC_INFO_CONFLICTS = 5;
  private Subscriber subscriber;
  
  public CVSSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote, Subscriber subscriber)
  {
    super(local, base, remote, ((ResourceVariantTreeSubscriber)subscriber).getResourceComparator());
    this.subscriber = subscriber;
  }
  
  public Subscriber getSubscriber()
  {
    return subscriber;
  }
  
  protected int calculateKind()
    throws TeamException
  {
    IResource local = getLocal();
    if (local.getType() != 1)
    {
      int folderKind = 0;
      ICVSRemoteFolder remote = (ICVSRemoteFolder)getRemote();
      ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor((IContainer)local);
      boolean isCVSFolder = false;
      try
      {
        isCVSFolder = cvsFolder.isCVSFolder();
      }
      catch (CVSException localCVSException) {}
      if (!local.exists())
      {
        if (remote != null) {
          if (isCVSFolder) {
            folderKind = 0;
          } else {
            folderKind = 9;
          }
        }
      }
      else if (remote == null)
      {
        if (isCVSFolder) {
          folderKind = 0;
        } else {
          folderKind = 5;
        }
      }
      else if (!isCVSFolder) {
        folderKind = 13;
      }
      return folderKind;
    }
    int kind = super.calculateKind();
    
    IResourceVariant remote = getRemote();
    if ((remote != null) && ((kind & 0x10) == 0))
    {
      RemoteResource cvsRemote = (RemoteResource)remote;
      int type = cvsRemote.getWorkspaceSyncState();
      switch (type)
      {
      case 6: 
        return kind | 0x40;
      case 7: 
        return kind | 0x20;
      }
    }
    kind = handleDeletionConflicts(kind);
    
    return kind;
  }
  
  protected int handleDeletionConflicts(int kind)
  {
    if (kind == 30) {
      try
      {
        IResource local = getLocal();
        ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(local);
        if ((!cvsResource.isFolder()) && (cvsResource.isManaged())) {
          SyncFileChangeListener.getDeferredHandler().handleConflictingDeletion(local);
        }
        return 0;
      }
      catch (CVSException e)
      {
        CVSProviderPlugin.log(e);
        return 14;
      }
    }
    return kind;
  }
  
  public IStatus makeOutgoing(IProgressMonitor monitor)
    throws TeamException
  {
    if (getLocal().getType() == 2) {
      return makeInSync();
    }
    int syncKind = getKind();
    boolean incoming = (syncKind & 0xC) == 8;
    boolean outgoing = (syncKind & 0xC) == 4;
    
    ICVSResource local = CVSWorkspaceRoot.getCVSResourceFor(getLocal());
    RemoteResource remote = (RemoteResource)getRemote();
    ResourceSyncInfo origInfo = local.getSyncInfo();
    MutableResourceSyncInfo info = null;
    if (origInfo != null) {
      info = origInfo.cloneMutable();
    }
    if (outgoing) {
      return Status.OK_STATUS;
    }
    if (incoming)
    {
      if (local.exists())
      {
        if (remote == null)
        {
          info.setAdded();
        }
        else
        {
          info.setRevision(remote.getSyncInfo().getRevision());
          info.setTimeStamp(null);
        }
      }
      else
      {
        if (remote == null)
        {
          info = null;
          return Status.OK_STATUS;
        }
        info = remote.getSyncInfo().cloneMutable();
        info.setDeleted(true);
      }
    }
    else if (local.exists())
    {
      if (getRemote() != null)
      {
        if (getBase() != null) {
          info.setRevision(remote.getSyncInfo().getRevision());
        } else {
          try
          {
            remote.getStorage(Policy.monitorFor(monitor)).getContents();
            info = remote.getSyncInfo().cloneMutable();
          }
          catch (CoreException e)
          {
            throw TeamException.asTeamException(e);
          }
        }
      }
      else if (getBase() != null) {
        info.setAdded();
      } else {
        Assert.isTrue(false);
      }
    }
    else if (getRemote() != null)
    {
      info.setRevision(remote.getSyncInfo().getRevision());
      info.setDeleted(true);
    }
    else
    {
      info = null;
      return Status.OK_STATUS;
    }
    if (info != null)
    {
      FolderSyncInfo parentInfo = local.getParent().getFolderSyncInfo();
      if (parentInfo == null) {
        return new CVSStatus(4, 3, NLS.bind(CVSMessages.CVSSyncInfo_9, new String[] { getLocal().getFullPath().toString() }), getLocal());
      }
      info.setTag(parentInfo.getTag());
    }
    ((ICVSFile)local).setSyncInfo(info, 0);
    return Status.OK_STATUS;
  }
  
  public IStatus makeInSync()
    throws CVSException
  {
    if (getLocal().getType() == 1) {
      return new CVSStatus(2, 1, NLS.bind(CVSMessages.CVSSyncInfo_7, new String[] { getLocal().getFullPath().toString() }), getLocal());
    }
    boolean outgoing = (getKind() & 0xC) == 4;
    if (outgoing) {
      return new CVSStatus(2, 2, NLS.bind(CVSMessages.CVSSyncInfo_8, new String[] { getLocal().getFullPath().toString() }), getLocal());
    }
    ICVSFolder local = CVSWorkspaceRoot.getCVSFolderFor((IContainer)getLocal());
    if ((getLocal().getType() == 2) && (!local.getParent().isCVSFolder())) {
      return new CVSStatus(4, 3, NLS.bind(CVSMessages.CVSSyncInfo_9, new String[] { getLocal().getFullPath().toString() }), getLocal());
    }
    if (!local.exists()) {
      local.mkdir();
    }
    RemoteFolder remote = (RemoteFolder)getRemote();
    if (((local.isManaged()) || (getLocal().getType() == 4)) && (local.isCVSFolder()))
    {
      if (remote == null) {
        return Status.OK_STATUS;
      }
      FolderSyncInfo remoteInfo = remote.getFolderSyncInfo();
      FolderSyncInfo localInfo = local.getFolderSyncInfo();
      if (!localInfo.getRoot().equals(remoteInfo.getRoot())) {
        return new CVSStatus(4, 5, NLS.bind(CVSMessages.CVSRemoteSyncElement_rootDiffers, new Object[] { local.getName(), remoteInfo.getRoot(), localInfo.getRoot() }), getLocal());
      }
      if (!localInfo.getRepository().equals(remoteInfo.getRepository())) {
        return new CVSStatus(4, 5, NLS.bind(CVSMessages.CVSRemoteSyncElement_repositoryDiffers, new Object[] { local.getName(), remoteInfo.getRepository(), localInfo.getRepository() }), getLocal());
      }
      return Status.OK_STATUS;
    }
    if (remote == null) {
      return new CVSStatus(4, 4, NLS.bind(CVSMessages.CVSSyncInfo_10, new String[] { getLocal().getFullPath().toString() }), getLocal());
    }
    FolderSyncInfo remoteInfo = remote.getFolderSyncInfo();
    FolderSyncInfo localInfo = local.getParent().getFolderSyncInfo();
    MutableFolderSyncInfo newInfo = remoteInfo.cloneMutable();
    newInfo.setTag(localInfo.getTag());
    newInfo.setStatic(false);
    local.setFolderSyncInfo(newInfo);
    return Status.OK_STATUS;
  }
  
  public String toString()
  {
    IResourceVariant base = getBase();
    IResourceVariant remote = getRemote();
    StringBuffer result = new StringBuffer(super.toString());
    result.append("Local: ");
    result.append(getLocal().toString());
    result.append(" Base: ");
    if (base == null) {
      result.append("none");
    } else {
      result.append(base.toString());
    }
    result.append(" Remote: ");
    if (remote == null) {
      result.append("none");
    } else {
      result.append(remote.toString());
    }
    return result.toString();
  }
  
  public String getLocalContentIdentifier()
  {
    ResourceSyncInfo info = getSyncInfoForLocal(getCVSFile());
    return info != null ? info.getRevision() : null;
  }
  
  public String getLocalAuthor(IProgressMonitor monitor)
  {
    ICVSFile cvsFile = getCVSFile();
    if (cvsFile == null) {
      return null;
    }
    ResourceSyncInfo info = getSyncInfoForLocal(cvsFile);
    if (info == null) {
      return null;
    }
    String localRevision = info.getRevision();
    if (localRevision == null) {
      return null;
    }
    ILogEntry[] entries = getLogEntries(cvsFile, monitor);
    if ((entries == null) || (entries.length == 0)) {
      return null;
    }
    for (int i = 0; i < entries.length; i++) {
      try
      {
        if (localRevision.equals(entries[i].getRemoteFile().getRevision())) {
          return entries[i].getAuthor();
        }
      }
      catch (TeamException e)
      {
        CVSProviderPlugin.log(e);
      }
    }
    return null;
  }
  
  private static ResourceSyncInfo getSyncInfoForLocal(ICVSFile cvsFile)
  {
    if (cvsFile == null) {
      return null;
    }
    try
    {
      return cvsFile.getSyncInfo();
    }
    catch (CVSException e)
    {
      CVSProviderPlugin.log(e);
    }
    return null;
  }
  
  private static ILogEntry[] getLogEntries(ICVSFile cvsFile, IProgressMonitor monitor)
  {
    try
    {
      return cvsFile.getLogEntries(monitor);
    }
    catch (TeamException e)
    {
      CVSProviderPlugin.log(e);
    }
    return null;
  }
  
  private ICVSFile getCVSFile()
  {
    IResource local = getLocal();
    if ((local != null) && (local.getType() == 1)) {
      return CVSWorkspaceRoot.getCVSFileFor((IFile)local);
    }
    return null;
  }
}

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

import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.internal.ccvs.core.filehistory.CVSResourceVariantFileRevision;
import org.eclipse.team.internal.core.mapping.ResourceVariantFileRevision;
import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;

public class CVSSyncTreeSubscriber$CVSSyncInfoToDiffConverter
  extends SyncInfoToDiffConverter
{
  final CVSSyncTreeSubscriber this$0;
  
  public CVSSyncTreeSubscriber$CVSSyncInfoToDiffConverter(CVSSyncTreeSubscriber paramCVSSyncTreeSubscriber)
  {
    this$0 = paramCVSSyncTreeSubscriber;
  }
  
  protected ResourceVariantFileRevision asFileRevision(IResourceVariant variant)
  {
    return new CVSResourceVariantFileRevision(variant);
  }
}

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

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.resources.IProject;
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.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.diff.IDiff;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.core.synchronize.SyncInfo;
import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.team.core.variants.IResourceVariantComparator;
import org.eclipse.team.core.variants.IResourceVariantTree;
import org.eclipse.team.core.variants.ResourceVariantTreeSubscriber;
import org.eclipse.team.internal.ccvs.core.filehistory.CVSResourceVariantFileRevision;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.core.mapping.ResourceVariantFileRevision;
import org.eclipse.team.internal.core.mapping.SyncInfoToDiffConverter;

public abstract class CVSSyncTreeSubscriber
  extends ResourceVariantTreeSubscriber
  implements IAdaptable
{
  public static final String SYNC_KEY_QUALIFIER = "org.eclipse.team.cvs";
  private IResourceVariantComparator comparisonCriteria;
  private QualifiedName id;
  private String name;
  private SyncInfoToDiffConverter converter = new CVSSyncInfoToDiffConverter();
  
  public class CVSSyncInfoToDiffConverter
    extends SyncInfoToDiffConverter
  {
    public CVSSyncInfoToDiffConverter() {}
    
    protected ResourceVariantFileRevision asFileRevision(IResourceVariant variant)
    {
      return new CVSResourceVariantFileRevision(variant);
    }
  }
  
  CVSSyncTreeSubscriber(QualifiedName id, String name)
  {
    this.id = id;
    this.name = name;
    comparisonCriteria = new CVSRevisionNumberCompareCriteria(isThreeWay());
  }
  
  public QualifiedName getId()
  {
    return id;
  }
  
  public String getName()
  {
    return name;
  }
  
  public SyncInfo getSyncInfo(IResource resource)
    throws TeamException
  {
    if (!isSupervised(resource)) {
      return null;
    }
    if ((resource.getType() == 1) || (!isThreeWay())) {
      return super.getSyncInfo(resource);
    }
    IResourceVariant remoteResource = getRemoteTree().getResourceVariant(resource);
    return getSyncInfo(resource, remoteResource, remoteResource);
  }
  
  public boolean isSupervised(IResource resource)
    throws TeamException
  {
    try
    {
      RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
      if (provider == null) {
        return false;
      }
      ICVSResource cvsThing = CVSWorkspaceRoot.getCVSResourceFor(resource);
      if (cvsThing.isIgnored()) {
        return getRemoteTree().hasResourceVariant(resource);
      }
      return true;
    }
    catch (TeamException e)
    {
      if ((e.getStatus().getCode() == 368) || (!resource.getProject().isAccessible())) {
        return false;
      }
      throw e;
    }
  }
  
  public IResourceVariantComparator getResourceComparator()
  {
    return comparisonCriteria;
  }
  
  protected SyncInfo getSyncInfo(IResource
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