use of org.tigris.subversion.subclipse.ui.decorator.SVNLightweightDecorator in project subclipse by subclipse.
the class SwitchOperation method execute.
protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
monitor.beginTask("Switch to Branch/Tag", resources.length);
try {
final List<IProject> projectList = new ArrayList<IProject>();
for (int i = 0; i < resources.length; i++) {
monitor.subTask("Switching " + resources[i].getName() + ". . .");
SVNUrl svnUrl = (SVNUrl) urlMap.get(resources[i]);
if (conflictResolver != null && conflictResolver instanceof SVNConflictResolver) {
((SVNConflictResolver) conflictResolver).setPart(getPart());
}
SVNWorkspaceSubscriber.getInstance().updateRemote(resources);
SwitchToUrlCommand command = new SwitchToUrlCommand(provider.getSVNWorkspaceRoot(), resources[i], svnUrl, svnRevision);
command.setDepth(depth);
command.setSetDepth(setDepth);
command.setIgnoreExternals(ignoreExternals);
command.setForce(force);
command.setIgnoreAncestry(ignoreAncestry);
command.setConflictResolver(conflictResolver);
command.run(monitor);
monitor.worked(1);
if (resources[i].getProject() != null && !projectList.contains(resources[i].getProject())) {
projectList.add(resources[i].getProject());
}
}
// Trigger lightweight refresh of decorators for project. This is needed because refreshLocal
// is not triggering a refresh for unchanged
// resources in Project Explorer.
Display.getDefault().asyncExec(new Runnable() {
public void run() {
SVNLightweightDecorator decorator = (SVNLightweightDecorator) SVNUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getBaseLabelProvider(SVNUIPlugin.DECORATOR_ID);
for (IProject project : projectList) {
decorator.refresh(project);
}
}
});
} catch (SVNException e) {
if (e.operationInterrupted()) {
showCancelledMessage();
} else {
collectStatus(e.getStatus());
}
} catch (TeamException e) {
collectStatus(e.getStatus());
} finally {
monitor.done();
}
}
Aggregations