Hi!
I'm quite new when it comes to RCP development after developing mostly plain old Java previously and I have run into a problem :-)
I have tried to solve this the POJO way, creating an object to store some values, in this case a particular type of Bundles.
The problem is that I can not access this object from my view classes, because they do not seem to carry a reference to the Activator class(?) I believe I have to do this in the Activator class, because the bundlelistener has to be registered with the context.
In my Activator class I have created an object servicesList containing a vector of Bundles
Code:
public class Activator extends AbstractUIPlugin implements BundleListener {
// The shared instance
private static Activator plugin;
public ServicesList servicesList;
and registered a BundleListener
Code:
public void start(BundleContext context) throws Exception {...
this.servicesList= new ServicesList();
context.addBundleListener(this);
...}
In the listener I store an array of all bundles and sort out the ones I am interested in
Code:
@Override
public void bundleChanged(BundleEvent event) {
Bundle[] bundles = context.getBundles();
servicesList.cleanList();
for(Bundle b:bundles){
if(b.getSymbolicName().startsWith("my.specific.bundletype.")){
servicesList.addServiceBundle(b);
}
}
}
I reallize this is probably not the Eclipse way of doing storage, so does someone have another solution?
Any help would be greatly appreciated!