Reputation: 1296
Here's something obvious that should be easy to do...
How do I retrieve a list of installed plugins at runtime? Can't see an obvious way to do this a Platform.getBundle() requires a specific plugin name.
Is this perhaps a restriction for some kind of security reason?
Upvotes: 16
Views: 9740
Reputation: 1323753
From here:
The BundleContext
class has a getBundles
() method that returns all installed bundles.
You get an instance of the BundleContext
when your bundle is activated BundleActivator.start(BundleContext))
.
You can use it to get some Bundle version number for instance.
The interactions between the bundles are done through two complementary mechanisms: the package export/import and the service registration lookup facility.
The publication and lookup of services are performed through the BundleContext
reference that each bundle receives at startup time.
During the publication process, the advertising bundles registers a service by publishing a Java interface it is implementing, and by providing a class implementing this interface.
The lookup is performed by the client bundle, which gets the service from the BundleContext
and uses it as a standard Java object.
Upvotes: 12
Reputation: 30644
If you're looking to write this in your code, see VonC's answer.
If you just want a view that does this, there's already one in eclipse: Window->Show View->Other...->PDE Runtime->Plugin Registry. This displays plugins, their extensions, dependencies, and who is providing extensions.
Upvotes: 4