Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes


Accepted answer

Permanent link
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.
Adam Coulthard selected this answer as the correct answer

1 vote

Comments

 Thanks for the quick answer Tim.  Using the IOperationFactory and the ILoadOperation has worked a treat but I'll definitely have a look into the load rules as well.


Cheers Adam


One other answer

Permanent link
 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);
}



0 votes

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.



Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,936

Question asked: May 30 '13, 5:45 a.m.

Question was seen: 6,209 times

Last updated: Aug 26 '18, 4:25 a.m.

Confirmation Cancel Confirm