Load workspace using API
Hello,
I'm creating a plugin to help our developers to "fast" load a workspace. For a certain development project there are certain eclipse projects that they would need to load to work. What I would like to do would be say if I choose this development project from a wizard a new workspace is created and it automatically loads the specific components and eclipse projects that the developer needs.
I've not been able to find anything obvious within the API to take a string "com.project.name" and pass this into a load mechanism to actually perform the load.
Any suggestions / pointers would be great.
Thanks
Adam
Accepted answer
It sounds like you want to just call out to something that will do the load for you with what you specify. You can use the IOperationFactory.instance.getLoadOperation(LoadDilemmaHandler) to get a load operation but you'll have to supply your own dilemma handler because the Eclipse dilemma handler isn't API. Otherwise, your users won't get the same kind of experience if there are issues during load that need user interaction.
I would recommend looking at load rules to achieve what you want without having to write your own plugin.
I would recommend looking at load rules to achieve what you want without having to write your own plugin.
One other answer
In general using plain java API here is a trace of what is possible (used in RTC 4.0.7):
IWorkspaceManager workspaceManager = ... IWorkspaceHandle workspaceHandle = ... String sandboxPathName = ... ISharingManager sharingManager = ... IItemManager itemManager = ... IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandle, progressMonitor); IPath sandboxPath = new Path(sandboxPathName); ILocation sandboxLocation = new PathLocation(sandboxPath); ISandbox sandbox = sharingManager.getSandbox(sandboxLocation, false); List<IComponentHandle> componentHandles = workspaceConnection.getComponents(); for (IComponentHandle componentHandle : componentHandles) { IComponent component = (IComponent) itemManager.fetchCompleteItem(componentHandle, IItemManager.DEFAULT, progressMonitor); IConfiguration configuration = workspaceConnection.configuration(componentHandle); Map<String, IVersionableHandle> versionableMap = configuration.childEntriesForRoot(progressMonitor); versionableHandles = versionableMap.values(); LoadDilemmaHandler loadDilemmaHandler = ... ILoadOperation loadOperation = IOperationFactory.instance.getLoadOperation(loadDilemmaHandler); loadOperation.requestLoad(sandbox,/*IRelativeLocation*/ null, workspaceConnection, componentHandle, versionableHandles); loadOperation.run(progressMonitor); sharingManager.deregister(sandbox, progressMonitor); }
Comments
I used a LoadDilemmaHandler similar to what you may find in
com.ibm.team.build.internal.scm.SourceControlUtility.updateFileCopyArea
Thanks for sharing this code.
I tried it (working currently on RTC 6.0.6), managed to load workspace into a sandbox.
However, when I try to refresh the sandbox from the RTC client after copying files into it, I don't see any indication in the pending changes view about unresolved files.
Any idea which API call is missing in order for refresh to work correctly ?
Thanks,
Gidi
I did not use this line
sharingManager.deregister(sandbox, progressMonitor);
If I call deregister the loaded components are marked as unloaded
and the sandbox is not known in RTC client.
and the sandbox is not known in RTC client.