1 11 package org.eclipse.team.internal.ccvs.ui.actions; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.resources.IResource; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.core.runtime.IStatus; 18 import org.eclipse.jface.action.IAction; 19 import org.eclipse.jface.operation.IRunnableWithProgress; 20 import org.eclipse.team.core.Team; 21 import org.eclipse.team.internal.ccvs.core.*; 22 import org.eclipse.team.internal.ccvs.ui.Policy; 23 import org.eclipse.ui.PlatformUI; 24 25 public class EditAction extends WorkspaceAction { 26 27 30 protected void execute(IAction action) throws InvocationTargetException , InterruptedException { 31 final EditorsAction editors = new EditorsAction(); 33 PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { 34 public void run(IProgressMonitor monitor) throws InvocationTargetException , InterruptedException { 35 executeProviderAction(editors, Policy.subMonitorFor(monitor, 25)); 36 37 if (!editors.promptToEdit(getShell())) { 39 return; 40 } 41 42 executeProviderAction(new IProviderAction() { 43 public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException { 44 provider.edit(resources, false , true , false , ICVSFile.NO_NOTIFICATION, monitor); 45 return Team.OK_STATUS; 46 } 47 }, Policy.subMonitorFor(monitor, 75)); 48 } 49 }); 50 } 51 52 55 protected boolean isEnabledForAddedResources() { 56 return false; 57 } 58 61 protected boolean isEnabledForCVSResource(ICVSResource cvsResource) throws CVSException { 62 if (cvsResource.isFolder()) return false; 63 if (super.isEnabledForCVSResource(cvsResource)) { 64 return ((ICVSFile)cvsResource).isReadOnly(); 65 } else { 66 return false; 67 } 68 } 69 70 } 71 | Popular Tags |