It's all about the answers!

Ask a question

How to get loaded component in RWS programmatically


Anbe Pham (403) | asked Feb 12 '20, 3:53 a.m.
In RWS, after I loaded some components into sandbox, these component turned to filled cyan color. And I want to get this loaded component list programmatically. Do anyone know which API can do this task?

Beside that, I want to get sanbox folder corresponding with each loaded component, how can I do that?

Accepted answer


permanent link
David Lafreniere (4.8k7) | answered Feb 12 '20, 10:09 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

The list of components shown in the Pending Changes view can be retrieved by: IComponentSyncModel.getComponentSyncContexts()

You can tell if a given component in a workspace is loaded via:


IComponentSyncModel model = FileSystemResourcesPlugin.getComponentSyncModel();
if (model.getLocalSynchronizationManager().isShared(workspace.getResolvedWorkspace(), component)) {
 // component is loaded
}

To hook a listener to know when components are loaded/unloaded (in case you need to respond to these events)
ILocalSynchronizationManager mgr = FileSystemResourcesPlugin.getComponentSyncModel().getLocalSynchronizationManager();
mgr.addGenericListener(ILocalSynchronizationManager.LOADED_COMPONENTS, fSharedComponentsListener);

For your second question, it's important to note that a given component could be loaded in multiple sandboxes.
To get the list of sandboxes you would first get the IWorkspaceConnection for the workspace in question, then call:

Collection<ISandbox> sandboxes = FileSystemCore.getSharingManager().getSandboxes(new ConfigurationFacade(workspaceConnection, component), monitor);


Anbe Pham selected this answer as the correct answer

Comments
Anbe Pham commented Feb 12 '20, 9:24 p.m.

Thank you very much. That is all I need to know.

Your answer


Register or to post your answer.