How to delete repository workspace directly?
My original intention is creating a repository workspace first, then delete it directly.
My code:
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
IWorkspaceConnection repoWorkspace = null;
repoWorkspace = wm.createWorkspace(repo.loggedInContributor(), workspaceName,workspaceDesc, monitor);
.//operation with the repoWorkspace .....
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance().setExactName(workspaceName);
List<IWorkspaceHandle> workspaceHandles= wm.findWorkspaces(criteria, Integer.MAX_VALUE, null);
wm.deleteWorkspace(workspaceHandles.get(0), null);
Now my question:
In my code, I have use criteria to find it first, then delete it. And I think it's not very good.So how can i delete it directly?
My code:
IWorkspaceManager wm = SCMPlatform.getWorkspaceManager(repo);
IWorkspaceConnection repoWorkspace = null;
repoWorkspace = wm.createWorkspace(repo.loggedInContributor(), workspaceName,workspaceDesc, monitor);
.//operation with the repoWorkspace .....
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance().setExactName(workspaceName);
List<IWorkspaceHandle> workspaceHandles= wm.findWorkspaces(criteria, Integer.MAX_VALUE, null);
wm.deleteWorkspace(workspaceHandles.get(0), null);
Now my question:
In my code, I have use criteria to find it first, then delete it. And I think it's not very good.So how can i delete it directly?
One answer
What do you mean with directly? If you store the original workspace object (wm in your example), you should be able to use that to delete the workspace. You only have to find it again, obviously, if you lost the object/interface class you got when creating it.
Comments
showing 5 of 6
show 1 more comments