What is the java API to check the loaded project in sandbox belong to which RTC component.
Accepted answer
-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);