It's all about the answers!

Ask a question

What is the java API to check the loaded project in sandbox belong to which RTC component.

Swapnil Sahu (135) | asked Jul 04 '17, 12:43 a.m.
edited Jul 05 '17, 2:30 p.m. by David Lafreniere (4.7k7)


I have project loaded from RTC component into my sandbox (Project Explorer) and
I want java code to find out the RTC component details -( names, number of baselines).

Accepted answer

permanent link
David Lafreniere (4.7k7) | answered Jul 05 '17, 2:30 p.m.

-Files/folders in Eclipse are of type:org.eclipse.core.resources.IResource

-You can adapt these to an IShareable using:
   IShareable shareable = (IShareable) fileResource.getAdapter(IShareable.class);

-You can figure out which IShare (which is the share root folder) a given file belongs to using the following: (Note: This is normally n Eclipse Project folder)
   IShare share = shareable .getShare(monitor);

-From an IShare, you can get the ISharingDescriptor using the code below. This can give you the repository, workspace context, and component.
ISharingDescriptor sharingDescriptor = share.getSharingDescriptor();

-Most of the other API that you may want can be found in IWorkspaceConnection, as shown below. This will have API for retrieving the list of components (see: #getComponents()) or list of baselines (see: #getBaselinesInHistory()).
   ScmPlatform.getWorkspaceManager(repo).getWorkspaceConnection(workspaceHandle, monitor);

Swapnil Sahu selected this answer as the correct answer

Your answer

Register or to post your answer.