Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2006 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 package org.eclipse.team.internal.ccvs.ui.operations;
 
 
 public abstract class SingleCommandOperation extends RepositoryProviderOperation {
 	
 	
 	public SingleCommandOperation(IWorkbenchPart partResourceMapping[] mappingsLocalOption[] options) {
 		super(partmappings);
 		if (options != null) {
 			this. = options;
 		}
 	}
 
 	/* (non-Javadoc)
 	 * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	protected void execute(CVSTeamProvider providerIResource[] resourcesboolean recurseIProgressMonitor monitorthrows CVSExceptionInterruptedException {
 		monitor.beginTask(null, 100);
 		Session session = new Session(getRemoteLocation(provider), getLocalRoot(provider), true /* output to console */);
 		session.open(Policy.subMonitorFor(monitor, 10), isServerModificationOperation());
 		try {
 			IStatus status = executeCommand(sessionprovidergetCVSArguments(sessionresources), recurse, Policy.subMonitorFor(monitor, 90));
 			if (isReportableError(status)) {
 			    throw new CVSException(status);
             }
 		} finally {
 			session.close();
 		}
 	}
 
 	protected final ICVSResource[] getCVSArguments(IResource[] resources) {
 		return super.getCVSArguments(resources);
 	}
 		
     protected ICVSResource[] getCVSArguments(Session sessionIResource[] resources) {
 		return getCVSArguments(resources);
 	}
 
 	/* (non-Javadoc)
      * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#execute(org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation.ICVSTraversal, org.eclipse.core.runtime.IProgressMonitor)
      */
     protected void execute(CVSTeamProvider providerICVSTraversal entryIProgressMonitor monitorthrows CVSExceptionInterruptedException {
         try {
             // TODO: This does not properly count the number of operations
             // Changing it causes an error in the test cases
             super.execute(providerentrymonitor);
             collectStatus(.);
         } catch (CVSException e) {
             collectStatus(e.getStatus());
         }
     }
Indicate whether the operation requires write access to the server (i.e. the operation changes state on the server whether it be to commit, tag, admin, etc).

Returns:
 
 	protected boolean isServerModificationOperation() {
 		return false;
 	}

Method overridden by subclasses to issue the command to the CVS repository using the given session.

Parameters:
session an open session which will be closed by the caller
provider the provider for the project that contains the resources
resources the resources to be operated on
recurse whether the operation is deep or shallow
monitor a progress monitor
 
 	protected abstract IStatus executeCommand(Session sessionCVSTeamProvider providerICVSResource[] resourcesboolean recurseIProgressMonitor monitorthrows CVSExceptionInterruptedException;
 
 	protected LocalOption[] getLocalOptions(boolean recurse) {
         LocalOption[] result = ;
         if (recurse) {
             // For deep operations, we just need to make sure that the -l option isn't present
             result = ..removeFrom();
         } else {
             result = ..removeFrom();
             result = ..addTo();
         }
		return result;
	}
	protected void setLocalOptions(LocalOption[] options) {
		this. = options;
	}
	protected void addLocalOption(LocalOption option) {
		 = option.addTo();
	}
New to GrepCode? Check out our FAQ X