1 11 package org.eclipse.team.internal.ccvs.ui.operations; 12 13 import org.eclipse.core.resources.*; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.core.runtime.jobs.ISchedulingRule; 16 import org.eclipse.osgi.util.NLS; 17 import org.eclipse.team.core.RepositoryProvider; 18 import org.eclipse.team.core.TeamException; 19 import org.eclipse.team.internal.ccvs.core.*; 20 import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; 21 import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer; 22 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; 23 import org.eclipse.ui.IWorkbenchPart; 24 25 28 public class DisconnectOperation extends RepositoryProviderOperation { 29 30 private boolean unmanage; 31 32 public DisconnectOperation(IWorkbenchPart part, IProject[] projects, boolean unmanage) { 33 super(part, projects); 34 this.unmanage = unmanage; 35 } 36 37 40 protected void execute( 41 CVSTeamProvider provider, 42 IResource[] resources, 43 boolean recurse, IProgressMonitor monitor) 44 throws CVSException, InterruptedException { 45 46 monitor.beginTask(null, IProgressMonitor.UNKNOWN); 48 IProject project = provider.getProject(); 49 try { 50 RepositoryProvider.unmap(project); 51 } catch (TeamException e) { 52 throw CVSException.wrapException(e); 53 } 54 if (unmanage) { 55 ICVSFolder cvsFolder = CVSWorkspaceRoot.getCVSFolderFor(project); 56 cvsFolder.unmanage(monitor); 57 EclipseSynchronizer.getInstance().deconfigure(project, Policy.subMonitorFor(monitor, IProgressMonitor.UNKNOWN)); 58 } 59 monitor.done(); 60 } 61 62 65 protected String getTaskName() { 66 return CVSUIMessages.DisconnectOperation_0; 67 } 68 69 72 protected String getTaskName(CVSTeamProvider provider) { 73 return NLS.bind(CVSUIMessages.DisconnectOperation_1, new String [] { provider.getProject().getName() }); 74 } 75 76 79 public boolean canRunAsJob() { 80 return false; 82 } 83 84 87 public boolean consultModelsForMappings() { 88 return false; 89 } 90 91 94 protected ISchedulingRule getSchedulingRule(CVSTeamProvider provider) { 95 return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(provider.getProject()); 96 } 97 98 } 99 | Popular Tags |