1 11 package org.eclipse.team.internal.ccvs.ui.operations; 12 13 import org.eclipse.core.runtime.IProgressMonitor; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.jface.action.IAction; 16 import org.eclipse.team.internal.ccvs.core.CVSException; 17 import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; 18 import org.eclipse.team.internal.ccvs.ui.Policy; 19 import org.eclipse.ui.IWorkbenchPart; 20 21 public abstract class CheckoutOperation extends RemoteOperation { 22 23 public CheckoutOperation(IWorkbenchPart part, ICVSRemoteFolder[] remoteFolders) { 24 super(part, remoteFolders); 25 } 26 27 30 public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException { 31 ICVSRemoteFolder[] folders = getRemoteFolders(); 32 checkout(folders, monitor); 33 } 34 35 43 protected void checkout(ICVSRemoteFolder[] folders, IProgressMonitor monitor) throws CVSException { 44 monitor.beginTask(null, folders.length * 100); 45 for (int i = 0; i < folders.length; i++) { 46 ICVSRemoteFolder folder = folders[i]; 47 IStatus result = checkout(folder, Policy.subMonitorFor(monitor, 100)); 48 collectStatus(result); 49 Policy.checkCanceled(monitor); 50 } 51 monitor.done(); 52 } 53 54 protected ICVSRemoteFolder[] getRemoteFolders() { 55 return (ICVSRemoteFolder[])getRemoteResources(); 56 } 57 58 63 protected abstract IStatus checkout(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException; 64 65 68 public boolean canRunAsJob() { 69 return true; 70 } 71 72 75 public boolean isKeepOneProgressServiceEntry() { 76 return true; 78 } 79 80 83 protected IAction getGotoAction() { 84 return getShowConsoleAction(); 85 } 86 } 87 | Popular Tags |