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

rn session.filterGlobalOptions(globalOptions);
  }
  
  protected LocalOption[] filterLocalOptions(Session session, GlobalOption[] globalOptions, LocalOption[] localOptions)
  {
    return localOptions;
  }
  
  public final IStatus execute(Session session, GlobalOption[] globalOptions, LocalOption[] localOptions, ICVSResource[] arguments, ICommandOutputListener listener, IProgressMonitor pm)
    throws CVSException
  {
    String[] stringArguments = convertArgumentsForOpenSession(arguments, session);
    return execute(session, globalOptions, localOptions, stringArguments, listener, pm);
  }
  
  protected String[] convertArgumentsForOpenSession(ICVSResource[] arguments, Session openSession)
    throws CVSException
  {
    List stringArguments = new ArrayList(arguments.length);
    for (int i = 0; i < arguments.length; i++) {
      stringArguments.add(arguments[i].getRelativePath(openSession.getLocalRoot()));
    }
    return (String[])stringArguments.toArray(new String[stringArguments.size()]);
  }
  
  protected IStatus mergeStatus(IStatus accumulatedStatus, IStatus newStatus)
  {
    if (accumulatedStatus.isMultiStatus())
    {
      ((MultiStatus)accumulatedStatus).merge(newStatus);
      return accumulatedStatus;
    }
    if (accumulatedStatus.isOK()) {
      return newStatus;
    }
    if (newStatus.isOK()) {
      return accumulatedStatus;
    }
    MultiStatus result = new MultiStatus("org.eclipse.team.cvs.core", 1, 
      new IStatus[] { accumulatedStatus, newStatus }, 
      NLS.bind(CVSMessages.Command_warnings, new String[] { getDisplayText() }), null);
    return result;
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation;

public class CommandOutputListener
  implements ICommandOutputListener
{
  public static final String ROOT_CVSIGNORE_READ_FAILURE = "cvs server: cannot open /root/.cvsignore: Permission denied";
  
  public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor)
  {
    return OK;
  }
  
  public IStatus errorLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor)
  {
    String protocolError = getProtocolError(line, location);
    if (protocolError != null) {
      return new CVSStatus(4, -23, protocolError, commandRoot);
    }
    if ((line.equals("cvs server: cannot open /root/.cvsignore: Permission denied")) || (getServerMessage("cvs server: cannot open /root/.cvsignore: Permission denied", location).equals(getServerMessage(line, location)))) {
      return new CVSStatus(2, -14, line, commandRoot);
    }
    return new CVSStatus(4, -14, line, commandRoot);
  }
  
  protected String getProtocolError(String line, ICVSRepositoryLocation location)
  {
    if (line.startsWith("Protocol error:")) {
      return line;
    }
    return null;
  }
  
  public String getServerMessage(String line, ICVSRepositoryLocation location)
  {
    return ((CVSRepositoryLocation)location).getServerMessageWithoutPrefix(line, "server: ");
  }
  
  public String getServerAbortedMessage(String line, ICVSRepositoryLocation location)
  {
    return ((CVSRepositoryLocation)location).getServerMessageWithoutPrefix(line, "[server aborted]: ");
  }
  
  public String getServerRTagMessage(String line, ICVSRepositoryLocation location)
  {
    return ((CVSRepositoryLocation)location).getServerMessageWithoutPrefix(line, "rtag: ");
  }
}

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

import java.util.Collection;
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.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
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.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;

public class Commit
  extends Command
{
  public static final Command.LocalOption FORCE = new Command.LocalOption("-f");
  
  protected String getRequestId()
  {
    return "ci";
  }
  
  protected ICVSResource[] sendLocalResourceState(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
    throws CVSException
  {
    checkResourcesManaged(session, resources);
    
    ModifiedFileSender visitor = new ModifiedFileSender(session, localOptions);
    visitor.visit(session, resources, monitor);
    
    ICVSFile[] changedFiles = visitor.getModifiedFiles();
    for (int i = 0; i < changedFiles.length; i++)
    {
      String fileName = changedFiles[i].getRelativePath(session.getLocalRoot());
      if (fileName.startsWith("-")) {
        fileName = "./" + fileName;
      }
      session.sendArgument(fileName);
    }
    return changedFiles;
  }
  
  protected IStatus commandFinished(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor, IStatus status)
    throws CVSException
  {
    if (status.getCode() == -10) {
      return status;
    }
    if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories()) {
      new PruneFolderVisitor().visit(session, resources);
    }
    if (status.isOK()) {
      for (int i = 0; i < resources.length; i++)
      {
        ICVSResource resource = resources[i];
        if (!resource.isFolder())
        {
          ICVSFile cvsFile = (ICVSFile)resources[i];
          if ((cvsFile.exists()) && (cvsFile.isModified(null))) {
            status = mergeStatus(status, clearModifiedState(cvsFile));
          }
        }
      }
    }
    return status;
  }
  
  protected IStatus clearModifiedState(ICVSFile cvsFile)
    throws CVSException
  {
    byte[] info = cvsFile.getSyncBytes();
    IResource resource = cvsFile.getIResource();
    String filePath;
    String filePath;
    if (resource == null) {
      filePath = cvsFile.getRepositoryRelativePath();
    } else {
      filePath = resource.getFullPath().toString();
    }
    if (info == null) {
      return new Status(2, "org.eclipse.team.cvs.core", 0, NLS.bind(CVSMessages.Commit_syncInfoMissing, new String[] { filePath }), null);
    }
    cvsFile.checkedIn(null, true);
    return new Status(1, "org.eclipse.team.cvs.core", 0, NLS.bind(CVSMessages.Commit_timestampReset, new String[] { filePath }), null);
  }
  
  protected void sendArguments(Session session, String[] arguments)
    throws CVSException
  {}
  
  public final IStatus execute(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] arguments, Collection filesToCommitAsText, ICommandOutputListener listener, IProgressMonitor pm)
    throws CVSException
  {
    session.setTextTransferOverride(filesToCommitAsText);
    try
    {
      return super.execute(session, globalOptions, localOptions, arguments, listener, pm);
    }
    finally
    {
      session.setTextTransferOverride(null);
    }
  }
  
  protected String getDisplayText()
  {
    return "commit";
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;

class ConsoleListeners$1
  implements ISafeRunnable
{
  final ConsoleListeners this$0;
  private final IConsoleListener val$listener;
  private final Session val$session;
  private final String val$line;
  
  ConsoleListeners$1(ConsoleListeners paramConsoleListeners, IConsoleListener paramIConsoleListener, Session paramSession, String paramString)
  {
    this$0 = paramConsoleListeners;val$listener = paramIConsoleListener;val$session = paramSession;val$line = paramString;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.commandInvoked(val$session, val$line);
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;

class ConsoleListeners$2
  implements ISafeRunnable
{
  final ConsoleListeners this$0;
  private final IConsoleListener val$listener;
  private final Session val$session;
  private final String val$line;
  private final IStatus val$status;
  
  ConsoleListeners$2(ConsoleListeners paramConsoleListeners, IConsoleListener paramIConsoleListener, Session paramSession, String paramString, IStatus paramIStatus)
  {
    this$0 = paramConsoleListeners;val$listener = paramIConsoleListener;val$session = paramSession;val$line = paramString;val$status = paramIStatus;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.messageLineReceived(val$session, val$line, val$status);
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;

class ConsoleListeners$3
  implements ISafeRunnable
{
  final ConsoleListeners this$0;
  private final IConsoleListener val$listener;
  private final Session val$session;
  private final String val$line;
  private final IStatus val$status;
  
  ConsoleListeners$3(ConsoleListeners paramConsoleListeners, IConsoleListener paramIConsoleListener, Session paramSession, String paramString, IStatus paramIStatus)
  {
    this$0 = paramConsoleListeners;val$listener = paramIConsoleListener;val$session = paramSession;val$line = paramString;val$status = paramIStatus;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.errorLineReceived(val$session, val$line, val$status);
  }
}

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

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;

class ConsoleListeners$4
  implements ISafeRunnable
{
  final ConsoleListeners this$0;
  private final IConsoleListener val$listener;
  private final Session val$session;
  private final IStatus val$status;
  private final Exception val$exception;
  
  ConsoleListeners$4(ConsoleListeners paramConsoleListeners, IConsoleListener paramIConsoleListener, Session paramSession, IStatus paramIStatus, Exception paramException)
  {
    this$0 = paramConsoleListeners;val$listener = paramIConsoleListener;val$session = paramSession;val$status = paramIStatus;val$exception = paramException;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$listener.commandCompleted(val$session, val$status, val$exception);
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.team.internal.ccvs.core.client.listeners.IConsoleListener;

public class ConsoleListeners
  implements IConsoleListener
{
  private static ConsoleListeners instance = new ConsoleListeners();
  private Set listeners = new HashSet();
  
  public static ConsoleListeners getInstance()
  {
    return instance;
  }
  
  public void addListener(IConsoleListener listener)
  {
    synchronized (listeners)
    {
      listeners.add(listener);
    }
  }
  
  public void removeListener(IConsoleListener listener)
  {
    synchronized (listeners)
    {
      listeners.remove(listener);
    }
  }
  
  /* Error */
  private IConsoleListener[] getListeners()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 84	org/eclipse/team/internal/ccvs/core/client/ConsoleListeners:listeners	Ljava/util/Set;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: getfield 84	org/eclipse/team/internal/ccvs/core/client/ConsoleListeners:listeners	Ljava/util/Set;
    //   11: aload_0
    //   12: getfield 84	org/eclipse/team/internal/ccvs/core/client/ConsoleListeners:listeners	Ljava/util/Set;
    //   15: invokeinterface 95 1 0
    //   20: anewarray 51	org/eclipse/team/internal/ccvs/core/client/listeners/IConsoleListener
    //   23: invokeinterface 99 2 0
    //   28: checkcast 41	[Lorg/eclipse/team/internal/ccvs/core/client/listeners/IConsoleListener;
    //   31: aload_1
    //   32: monitorexit
    //   33: areturn
    //   34: aload_1
    //   35: monitorexit
    //   36: athrow
    // Line number table:
    //   Java source line #51	-> byte code offset #0
    //   Java source line #52	-> byte code offset #7
    //   Java source line #51	-> byte code offset #34
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	37	0	this	ConsoleListeners
    //   5	30	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	33	34	finally
    //   34	36	34	finally
  }
  
  public void commandInvoked(Session session, String line)
  {
    if (this.listeners.isEmpty()) {
      return;
    }
    IConsoleListener[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      IConsoleListener listener = listeners[i];
      Platform.run(new ISafeRunnable()
      {
        private final IConsoleListener val$listener;
        private final Session val$session;
        private final String val$line;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$listener.commandInvoked(val$session, val$line);
        }
      });
    }
  }
  
  public void messageLineReceived(Session session, String line, IStatus status)
  {
    if (this.listeners.isEmpty()) {
      return;
    }
    IConsoleListener[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      IConsoleListener listener = listeners[i];
      Platform.run(new ISafeRunnable()
      {
        private final IConsoleListener val$listener;
        private final Session val$session;
        private final String val$line;
        private final IStatus val$status;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$listener.messageLineReceived(val$session, val$line, val$status);
        }
      });
    }
  }
  
  public void errorLineReceived(Session session, String line, IStatus status)
  {
    if (this.listeners.isEmpty()) {
      return;
    }
    IConsoleListener[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      IConsoleListener listener = listeners[i];
      Platform.run(new ISafeRunnable()
      {
        private final IConsoleListener val$listener;
        private final Session val$session;
        private final String val$line;
        private final IStatus val$status;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$listener.errorLineReceived(val$session, val$line, val$status);
        }
      });
    }
  }
  
  public void commandCompleted(Session session, IStatus status, Exception exception)
  {
    if (this.listeners.isEmpty()) {
      return;
    }
    IConsoleListener[] listeners = getListeners();
    for (int i = 0; i < listeners.length; i++)
    {
      IConsoleListener listener = listeners[i];
      Platform.run(new ISafeRunnable()
      {
        private final IConsoleListener val$listener;
        private final Session val$session;
        private final IStatus val$status;
        private final Exception val$exception;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$listener.commandCompleted(val$session, val$status, val$exception);
        }
      });
    }
  }
}

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

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;

class CopyHandler
  extends ResponseHandler
{
  public String getResponseID()
  {
    return "Copy-file";
  }
  
  public void handle(Session session, String localDir, IProgressMonitor monitor)
    throws CVSException
  {
    String repositoryFile = session.readLine();
    String newFile = session.readLine();
    if ((session.isNoLocalChanges()) || (!session.isCreateBackups())) {
      return;
    }
    String fileName = repositoryFile.substring(repositoryFile.lastIndexOf("/") + 1);
    ICVSFolder mParent = session.getLocalRoot().getFolder(localDir);
    ICVSFile mFile = mParent.getFile(fileName);
    
    Assert.isTrue(mParent.exists());
    Assert.isTrue((mFile.exists()) && (mFile.isManaged()));
    
    mFile.copyTo(newFile);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;
import org.eclipse.team.internal.ccvs.core.connection.CVSServerException;

public class Diff
  extends Command
{
  public static final Command.LocalOption UNIFIED_FORMAT = new Command.LocalOption("-u");
  public static final Command.LocalOption CONTEXT_FORMAT = new Command.LocalOption("-c");
  public static final Command.LocalOption INCLUDE_NEWFILES = new Command.LocalOption("-N");
  public static final Command.LocalOption BRIEF = new Command.LocalOption("--brief");
  
  protected String getRequestId()
  {
    return "diff";
  }
  
  protected IStatus doExecute(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor)
    throws CVSException
  {
    try
    {
      IStatus status = super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor);
      if ((status.getCode() == -10) && 
        (status.isMultiStatus()))
      {
        IStatus[] children = status.getChildren();
        for (int i = 0; i < children.length; i++)
        {
          IStatus child = children[i];
          if (child.getMessage().indexOf("[diff aborted]") != -1) {
            throw new CVSServerException(status);
          }
        }
      }
      return status;
    }
    catch (CVSServerException e)
    {
      if (e.containsErrors()) {
        throw e;
      }
      return e.getStatus();
    }
  }
  
  protected ICVSResource[] sendLocalResourceState(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
    throws CVSException
  {
    checkResourcesManaged(session, resources);
    DiffStructureVisitor visitor = new DiffStructureVisitor(session, localOptions);
    visitor.visit(session, resources, monitor);
    return resources;
  }
  
  protected String getServerErrorMessage()
  {
    return CVSMessages.Diff_serverError;
  }
}

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

import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;

class DiffStructureVisitor
  extends FileStructureVisitor
{
  public DiffStructureVisitor(Session session, Command.LocalOption[] localOptions)
  {
    super(session, localOptions, true, true);
  }
  
  protected void sendFile(ICVSFile mFile)
    throws CVSException
  {
    byte[] info = mFile.getSyncBytes();
    if (info == null) {
      return;
    }
    sendFolder(mFile.getParent());
    Policy.checkCanceled(monitor);
    session.sendEntry(info, null);
    if (!mFile.exists()) {
      return;
    }
    if (mFile.isModified(null)) {
      session.sendModified(mFile, ResourceSyncInfo.isBinary(info), monitor);
    } else {
      session.sendUnchanged(mFile);
    }
  }
}

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

public class Editors
  extends AbstractMessageCommand
{
  protected String getRequestId()
  {
    return "editors";
  }
  
  protected boolean isWorkspaceModification()
  {
    return false;
  }
}

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

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

public class ExpandModules
  extends Request
{
  protected String getRequestId()
  {
    return "expand-modules";
  }
  
  public IStatus execute(Session session, String[] modules, IProgressMonitor monitor)
    throws CVSException
  {
    session.resetModuleExpansion();
    for (int i = 0; i < modules.length; i++) {
      session.sendArgument(modules[i]);
    }
    return executeRequest(session, Command.DEFAULT_OUTPUT_LISTENER, monitor);
  }
}

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

import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;

class FileStructureVisitor
  extends AbstractStructureVisitor
{
  private boolean sendEmptyFolders;
  
  public FileStructureVisitor(Session session, Command.LocalOption[] localOptions, boolean sendEmptyFolders, boolean sendModifiedContents)
  {
    this(session, localOptions, sendEmptyFolders, sendModifiedContents, true);
  }
  
  public FileStructureVisitor(Session session, Command.LocalOption[] localOptions, boolean sendEmptyFolders, boolean sendModifiedContents, boolean sendBinary)
  {
    super(session, localOptions, true, sendModifiedContents, sendBinary);
    this.sendEmptyFolders = sendEmptyFolders;
  }
  
  public void visitFile(ICVSFile mFile)
    throws CVSException
  {
    sendFile(mFile);
  }
  
  public void visitFolder(ICVSFolder mFolder)
    throws CVSException
  {
    if (sendEmptyFolders) {
      sendFolder(mFolder);
    }
    boolean exists = mFolder.exists();
    boolean isCVSFolder = mFolder.isCVSFolder();
    if (!isCVSFolder) {
      return;
    }
    if ((exists) && (isOrphanedSubtree(mFolder))) {
      return;
    }
    ICVSResource[] children = mFolder.members(123);
    sendFiles(children);
    sendQuestionableFolders(children);
    if (isRecurse()) {
      sendManagedFolders(children);
    }
  }
  
  private void sendManagedFolders(ICVSResource[] children)
    throws CVSException
  {
    for (int i = 0; i < children.length; i++)
    {
      ICVSResource resource = children[i];
      if ((resource.isFolder()) && (resource.isManaged())) {
        resource.accept(this);
      }
    }
  }
  
  private void sendQuestionableFolders(ICVSResource[] children)
    throws CVSException
  {
    for (int i = 0; i < children.length; i++)
    {
      ICVSResource resource = children[i];
      if ((resource.isFolder()) && (!resource.isManaged())) {
        resource.accept(this);
      }
    }
  }
  
  private void sendFiles(ICVSResource[] children)
    throws CVSException
  {
    for (int i = 0; i < children.length; i++)
    {
      ICVSResource resource = children[i];
      if (!resource.isFolder()) {
        resource.accept(this);
      }
    }
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener;

public class Import
  extends Command
{
  protected String getRequestId()
  {
    return "import";
  }
  
  protected ICVSResource[] computeWorkResources(Session session, Command.LocalOption[] localOptions, String[] arguments)
    throws CVSException
  {
    if (arguments.length < 3) {
      throw new IllegalArgumentException();
    }
    return new ICVSResource[0];
  }
  
  protected IStatus doExecute(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, String[] arguments, ICommandOutputListener listener, IProgressMonitor monitor)
    throws CVSException
  {
    if (findOption(localOptions, "-b") == null)
    {
      Command.LocalOption[] newLocalOptions = new Command.LocalOption[localOptions.length + 1];
      newLocalOptions[0] = new Command.LocalOption("-b", "1.1.1");
      System.arraycopy(localOptions, 0, newLocalOptions, 1, localOptions.length);
      localOptions = newLocalOptions;
    }
    return super.doExecute(session, globalOptions, localOptions, arguments, listener, monitor);
  }
  
  protected ICVSResource[] sendLocalResourceState(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
    throws CVSException
  {
    ICVSResourceVisitor visitor = new ImportStructureVisitor(session, 
      collectOptionArguments(localOptions, "-W"), monitor);
    session.getLocalRoot().accept(visitor);
    return resources;
  }
  
  protected void sendLocalWorkingDirectory(Session session)
    throws CVSException
  {
    session.sendConstructedRootDirectory();
  }
}

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

import java.util.StringTokenizer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.core.IFileContentManager;
import org.eclipse.team.core.Team;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResourceVisitor;
import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.util.FileNameMatcher;

class ImportStructureVisitor
  implements ICVSResourceVisitor
{
  private static final String KEYWORD_OPTION = "-k";
  private static final String QUOTE = "'";
  protected Session session;
  protected IProgressMonitor monitor;
  private FileNameMatcher ignoreMatcher;
  private FileNameMatcher wrapMatcher;
  
  public ImportStructureVisitor(Session session, String[] wrappers, IProgressMonitor monitor)
  {
    this.session = session;
    this.monitor = Policy.infiniteSubMonitorFor(monitor, 512);
    wrapMatcher = initWrapMatcher(wrappers);
  }
  
  private FileNameMatcher initWrapMatcher(String[] wrappers)
  {
    if (wrappers == null) {
      return null;
    }
    FileNameMatcher wrapMatcher = new FileNameMatcher();
    for (int i = 0; i < wrappers.length; i++) {
      if (wrappers[i].indexOf("-k") != -1)
      {
        StringTokenizer st = new StringTokenizer(wrappers[i]);
        String pattern = st.nextToken();
        String option = st.nextToken();
        
        StringTokenizer quoteSt = 
          new StringTokenizer(st.nextToken(), "'");
        option = option + quoteSt.nextToken();
        
        wrapMatcher.register(pattern, option);
      }
    }
    return wrapMatcher;
  }
  
  public void visitFile(ICVSFile mFile)
    throws CVSException
  {
    if ((ignoreMatcher != null) && (ignoreMatcher.match(mFile.getName()))) {
      return;
    }
    boolean binary = Team.getFileContentManager().getType((IFile)mFile.getIResource()) == 2;
    if (wrapMatcher != null)
    {
      String mode = wrapMatcher.getMatch(mFile.getName());
      if (mode != null) {
        binary = Command.KSubstOption.fromMode(mode).isBinary();
      }
    }
    session.sendModified(mFile, binary, monitor);
  }
  
  public void visitFolder(ICVSFolder mFolder)
    throws CVSException
  {
    if ((ignoreMatcher != null) && (ignoreMatcher.match(mFolder.getName()))) {
      return;
    }
    String localPath = mFolder.getRelativePath(session.getLocalRoot());
    monitor.subTask(NLS.bind(CVSMessages.AbstractStructureVisitor_sendingFolder, new String[] { localPath }));
    
    session.sendConstructedDirectory(localPath);
    mFolder.acceptChildren(this);
  }
}

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

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

public class Log
  extends AbstractMessageCommand
{
  public static Command.LocalOption makeRevisionOption(String revision)
  {
    return new Command.LocalOption("-r" + revision, null);
  }
  
  public static final Command.LocalOption RCS_FILE_NAMES_ONLY = new Command.LocalOption("-R");
  public static final Command.LocalOption NO_TAGS = new Command.LocalOption("-N");
  
  protected String getRequestId()
  {
    return "log";
  }
  
  protected ICVSResource[] sendLocalResourceState(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
    throws CVSException
  {
    boolean sendEmptyFolders = Command.findOption(localOptions, RCS_FILE_NAMES_ONLY.getOption()) != null;
    new FileStructureVisitor(session, localOptions, sendEmptyFolders, false).visit(session, resources, monitor);
    return resources;
  }
}

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

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

public class MTHandler
  extends ResponseHandler
{
  private String nextLine;
  private boolean isLineAvailable;
  
  ResponseHandler getInstance()
  {
    return new MTHandler();
  }
  
  public String getResponseID()
  {
    return "MT";
  }
  
  public void handle(Session session, String argument, IProgressMonitor monitor)
    throws CVSException
  {
    if (isLineAvailable()) {
      startNextLine();
    }
    if (argument.charAt(0) == '+')
    {
      startNextLine();
    }
    else if (argument.charAt(0) == '-')
    {
      if (nextLine != null) {
        isLineAvailable = true;
      }
    }
    else
    {
      int spaceIndex = argument.indexOf(' ');
      String text;
      String tag;
      String text;
      if (spaceIndex == -1)
      {
        String tag = argument;
        text = null;
      }
      else
      {
        tag = argument.substring(0, spaceIndex);
        text = argument.substring(spaceIndex + 1);
      }
      if (tag.equals("newline"))
      {
        isLineAvailable = true;
      }
      else if (text != null)
      {
        if (isLineAvailable()) {
          startNextLine();
        }
        if (nextLine == null) {
          nextLine = text;
        } else {
          nextLine += text;
        }
      }
    }
  }
  
  public boolean isLineAvailable()
  {
    return isLineAvailable;
  }
  
  public String getLine()
  {
    return nextLine;
  }
  
  private void startNextLine()
  {
    isLineAvailable = false;
    nextLine = null;
  }
}

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

import java.text.ParseException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSMessages;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
import org.eclipse.team.internal.ccvs.core.util.CVSDateFormatter;

class ModTimeHandler
  extends ResponseHandler
{
  public String getResponseID()
  {
    return "Mod-time";
  }
  
  public void handle(Session session, String timeStamp, IProgressMonitor monitor)
    throws CVSException
  {
    try
    {
      session.setModTime(CVSDateFormatter.serverStampToDate(timeStamp));
    }
    catch (ParseException e)
    {
      IStatus status = new CVSStatus(4, 4, NLS.bind(CVSMessages.ModTimeHandler_invalidFormat, new String[] { timeStamp }), e, session.getLocalRoot());
      throw new CVSException(status);
    }
  }
}

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

import java.util.HashSet;
import java.util.Set;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;

class ModifiedFileSender
  extends FileStructureVisitor
{
  private final Set modifiedFiles;
  
  public ModifiedFileSender(Session session, Command.LocalOption[] localOptions)
  {
    super(session, localOptions, false, true);
    modifiedFiles = new HashSet();
  }
  
  protected void sendFile(ICVSFile mFile)
    throws CVSException
  {
    if ((mFile.isManaged()) && (mFile.isModified(null)))
    {
      super.sendFile(mFile);
      modifiedFiles.add(mFile);
    }
  }
  
  protected String getSendFileMessage()
  {
    return null;
  }
  
  public ICVSFile[] getModifiedFiles()
  {
    return (ICVSFile[])modifiedFiles.toArray(new ICVSFile[modifiedFiles.size()]);
  }
}

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

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

public class ModuleExpansionHandler
  extends ResponseHandler
{
  public String getResponseID()
  {
    return "Module-expansion";
  }
  
  public void handle(Session session, String expansion, IProgressMonitor monitor)
    throws CVSException
  {
    session.addModuleExpansion(expansion);
  }
}

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

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

public class NOOPCommand
  extends Command
{
  protected ICVSResource[] sendLocalResourceState(Session session, Command.GlobalOption[] globalOptions, Command.LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor)
    throws CVSException
  {
    new NOOPVisitor(session, localOptions).visit(session, resources, monitor);
    return resources;
  }
  
  protected String getRequestId()
  {
    return "noop";
  }
  
  protected void sendArguments(Session session, String[] arguments)
    throws CVSException
  {}
  
  protected boolean isWorkspaceModification()
  {
    return false;
  }
}

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

import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;

public class NOOPVisitor
  extends AbstractStructureVisitor
{
  public NOOPVisitor(Session session, Command.LocalOption[] localOptions)
  {
    super(session, localOptions, false, false);
  }
  
  public void visitFile(ICVSFile file)
    throws CVSException
  {
    sendPendingNotification(file);
  }
  
  public void visitFolder(ICVSFolder folder)
    throws CVSException
  {
    if ((isRecurse()) && (folder.isCVSFolder())) {
      folder.acceptChildren(this);
    }
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolde
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