I'm developing several Eclipse Features (groups of Eclipse plugins that form an Installable Unit), and I've been given the requirement that each Feature must have the ability to be deactivated, or in other words, made to not start when Eclipse is started.
I have a plugin that makes contributions to the UI (Perspective, Wizards, Menu items, etc), and I've tried to just intercept the call to the start method of the plugin like so...
Please note that the class PluginVerification is running in another plugin that will be delivered with the installation of the Feature that contains the plugins that I want to stop. In other words, my Feature consists of Plugins A, B, and C. PluginVerification lives in C, and I want to use it to control the starting of Plugins A and B.
Here's Plugin A and B's Activator class's start method
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
if(PluginVerification.verify(this)) {
super.start(context);
plugin = this;
}
}
If the call to PluginVerification.verify(this) returns false, then I don't start the plugin. This works half way, because the plugin truly does not start, but there are UI artifacts that were contributed by this plugin that still show up. For example, the wizards that this plugin contributes are still accessible via the UI. But when you try to use one of them, NullPointerExceptions are thrown because the plugin never started.
I was hoping someone could help me find better place to truly stop a plugin from starting so that it won't contribute it's UI artifacts at all. I'm planning to alert the user that his product isn't verified, and therefore could not be started. I want the user to feel as if the Feature has simply disappeared from his Eclipse environment.
Thank you for your consideration, Trace
You'll want to have a look at the
<eclipse_home>/configuration/config.ini
file and theosgi.bundles
propertySee the eclipse help:
I think you should be able to achieve what you want to do by adding you bundle to that list and not having it listed as "start"´and/or changing the startlevels between you plugins so that one starts before the other.
Also, check out Dude, where's my bundle
I think you will have better luck with p2 director. As to why some artifacts are available, probably because your plugins are installed (you can check with osgi console) but are not started..