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

How to get loaded component in RWS programmatically

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?

0 votes


Accepted answer

Permanent link

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

1 vote

Comments

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

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
× 12,024
× 411

Question asked: Feb 12 '20, 3:53 a.m.

Question was seen: 856 times

Last updated: Feb 12 '20, 9:24 p.m.

Confirmation Cancel Confirm