use of org.tigris.subversion.subclipse.core.internal.InfiniteSubProgressMonitor in project subclipse by subclipse.
the class UnmanageAction method getOperation.
/**
* get the WorkspaceModifyOperation. The operation will : - delete svn directories if this option
* has been chosen - unmap the project
*
* @return
*/
private IRunnableWithProgress getOperation() {
return new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InvocationTargetException {
try {
// maps the selected resources (projects) to their providers
Hashtable table = getProviderMapping(getSelectedResources());
Set keySet = table.keySet();
// $NON-NLS-1$
monitor.beginTask("", keySet.size() * 1000);
// $NON-NLS-1$
monitor.setTaskName(Policy.bind("Unmanage.unmanaging"));
Iterator iterator = keySet.iterator();
while (iterator.hasNext()) {
IProgressMonitor subMonitor = new InfiniteSubProgressMonitor(monitor, 1000);
subMonitor.beginTask(null, 100);
SVNTeamProvider provider = (SVNTeamProvider) iterator.next();
// get the resources (projects) to unmanage for the given provider
List list = (List) table.get(provider);
IResource[] providerResources = (IResource[]) list.toArray(new IResource[list.size()]);
for (int i = 0; i < providerResources.length; i++) {
// get the folder for the project
IResource resource = providerResources[i];
ISVNLocalFolder folder = SVNWorkspaceRoot.getSVNFolderFor((IContainer) resource);
try {
if (deleteContent) {
folder.unmanage(Policy.subMonitorFor(subMonitor, 10));
}
} finally {
// We want to remove the nature even if the unmanage operation fails
RepositoryProvider.unmap((IProject) resource);
}
}
}
} catch (TeamException e) {
throw new InvocationTargetException(e);
} finally {
monitor.done();
}
}
};
}
Aggregations