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?
Accepted answer
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)) {
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);
}
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);