1 11 package org.eclipse.team.internal.ccvs.ui.operations; 12 13 import java.util.ArrayList ; 14 import java.util.Arrays ; 15 import java.util.List ; 16 17 import org.eclipse.core.resources.*; 18 import org.eclipse.core.resources.mapping.ResourceMappingContext; 19 import org.eclipse.core.runtime.IProgressMonitor; 20 import org.eclipse.core.runtime.IStatus; 21 import org.eclipse.osgi.util.NLS; 22 import org.eclipse.team.core.mapping.provider.SynchronizationScopeManager; 23 import org.eclipse.team.internal.ccvs.core.*; 24 import org.eclipse.team.internal.ccvs.core.client.*; 25 import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption; 26 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; 27 import org.eclipse.ui.IWorkbenchPart; 28 29 33 public class UpdateOnlyMergableOperation extends SingleCommandOperation { 34 35 List skippedFiles = new ArrayList (); 36 private final IProject project; 37 38 public UpdateOnlyMergableOperation(IWorkbenchPart part, IProject project, IResource[] resources, LocalOption[] localOptions) { 39 super(part, asResourceMappers(resources), localOptions); 40 this.project = project; 41 } 42 43 46 protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException { 47 UpdateMergableOnly update = new UpdateMergableOnly(); 48 IStatus status = update.execute( 49 session, 50 Command.NO_GLOBAL_OPTIONS, 51 getLocalOptions(recurse), 52 resources, 53 null, 54 monitor); 55 if (status.getSeverity() != IStatus.ERROR) { 56 addSkippedFiles(update.getSkippedFiles()); 57 return OK; 58 } 59 return status; 60 } 61 62 65 protected String getTaskName() { 66 return CVSUIMessages.UpdateOnlyMergeable_taskName; 67 } 68 69 72 protected String getTaskName(CVSTeamProvider provider) { 73 return NLS.bind(CVSUIMessages.UpdateOperation_0, new String [] { provider.getProject().getName() }); 74 } 75 76 protected void addSkippedFiles(IFile[] files) { 77 skippedFiles.addAll(Arrays.asList(files)); 78 } 79 80 public IFile[] getSkippedFiles() { 81 return (IFile[]) skippedFiles.toArray(new IFile[skippedFiles.size()]); 82 } 83 84 87 protected ResourceMappingContext getResourceMappingContext() { 88 return new SingleProjectSubscriberContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber(), false, project); 89 } 90 91 protected SynchronizationScopeManager createScopeManager(boolean consultModels) { 92 return new SingleProjectScopeManager(getJobName(), getSelectedMappings(), getResourceMappingContext(), consultModels, project); 93 } 94 } 95 | Popular Tags |