How to listen to the state of bundles? [message #511525] |
Mon, 01 February 2010 16:58 |
James Willans Messages: 47 Registered: July 2009 |
Member |
|
|
Hello All,
I want to be able to listen to the state of bundles in the working
(development) platform so that I receive notification of when the
name/version of a bundle changes and when dependencies are added and
removed etc.
The most obvious way of doing seems to be using:
IPluginModelBase.addModelChangedListener(..)
Is this the recommended approach to take to achieve what I want?
If so I am running into a problem where seemingly stale information is
being broadcast. For example if the listener is implemented as follows:
pluginModel.addModelChangedListener(new IModelChangedListener() {
@Override
public void modelChanged(IModelChangedEvent event) {
System.out.println("** Change event **");
String id = pluginModel.getPluginBase().getId();
String version = pluginModel.getPluginBase().getVersion();
System.out.println("id : " + id);
System.out.println("Version: " + version);
}
});
Then changes to the bundle via the manifest editor do not seem to be
correctly reported. For example, assuming that the bundle id is
"BundleA" and the version is 1.0:
1) Bundle id is changed to "BundleB" the output is correct:
** Change event **
id : BundleB
Version: 1.0.0
2) Bundle version is changed to "2.0.0" the event is fired but the
output is stale:
** Change event **
id : BundleB
Version: 1.0.0
3) Bundle version is changed to "3.0.0" the output continues to be stale:
** Change event **
id : BundleB
Version: 2.0.0
This is similarly the case when monitoring the dependencies and other
features of the model. What am I doing wrong?
I would *really* appreciate some help here because it is a major blocker
to the project.
Kind Regards,
James
|
|
|
Powered by
FUDForum. Page generated in 0.24183 seconds