1 11 package org.eclipse.team.internal.ccvs.core.client; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.team.internal.ccvs.core.*; 18 import org.eclipse.team.internal.ccvs.core.CVSException; 19 import org.eclipse.team.internal.ccvs.core.ICVSResource; 20 21 24 public abstract class RemoteCommand extends Command { 25 26 protected ICVSResource[] computeWorkResources(Session session, LocalOption[] localOptions, 27 String [] arguments) throws CVSException { 28 return new ICVSResource[0]; 29 } 30 31 protected ICVSResource[] sendLocalResourceState(Session session, GlobalOption[] globalOptions, 32 LocalOption[] localOptions, ICVSResource[] resources, IProgressMonitor monitor) 33 throws CVSException { 34 35 monitor.beginTask(null, 100); 37 monitor.done(); 38 return resources; 39 } 40 41 protected void sendLocalWorkingDirectory(Session session) throws CVSException { 42 } 44 45 48 protected String [] convertArgumentsForOpenSession( 49 ICVSResource[] arguments, 50 Session openSession) 51 throws CVSException { 52 53 List stringArguments = new ArrayList (arguments.length); 55 for (int i = 0; i < arguments.length; i++) { 56 ICVSResource resource = arguments[i]; 57 String remotePath; 58 if (isDefinedModule(resource)) { 59 remotePath = resource.getName(); 60 } else { 61 remotePath = resource.getRepositoryRelativePath(); 62 63 } 64 stringArguments.add(remotePath); 65 } 66 return (String []) stringArguments.toArray(new String [stringArguments.size()]); 67 } 68 69 private boolean isDefinedModule(ICVSResource resource) { 70 return resource instanceof ICVSRemoteFolder && ((ICVSRemoteFolder)resource).isDefinedModule(); 71 } 72 73 } 74 | Popular Tags |