Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Given a Bundle, how can I find what extensions it provides?
Given a Bundle, how can I find what extensions it provides? [message #754330] Wed, 02 November 2011 08:16 Go to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
I can install plug-ins at the run time:
Bundle bundle = getBundleContext().installBundle(location);
bundle.start();

This gives me a Bundle object.

Now, how can I find what extensions are defined in its plugin.xml? IExtensionRegistry doesn't seem to have any useful methods for this.
Re: Given a Bundle, how can I find what extensions it provides? [message #754423 is a reply to message #754330] Wed, 02 November 2011 14:07 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

I asked around and you can ask for all extensions for an extension point and filter for the one contributor (I think I saw you post that on stackoverflow.com).

The other option is to ask for all extensions from a contributor and filter that:

IContributor ic = new IContributor() {
  public String getName() {
    return "com.example.plugin";
  }
};
IExtension[] extensions = extensionRegistry.getExtensions(ic);


Then pick out extensions for the extension point in question.

If you are in a dynamic scenario where bundles are being installed, you can always use the IRegistryEventListener. It would be fired with all of the IExtensions that were just added.

Later,
PW


Re: Given a Bundle, how can I find what extensions it provides? [message #754433 is a reply to message #754423] Wed, 02 November 2011 14:15 Go to previous message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
Quote:
The other option is to ask for all extensions from a contributor and filter that

Oh, so the contributors are just checked by name and not by identity? Thanks!
Quote:

If you are in a dynamic scenario where bundles are being installed, you can always use the IRegistryEventListener. It would be fired with all of the IExtensions that were just added.

Yes, I've considered doing that, but thought that since Eclipse keeps this information anyway (to remove extensions on bundle uninstallation) I should check if it's accessible more easily.
Previous Topic:Java7 and Deploying
Next Topic:swing2swt library
Goto Forum:
  


Current Time: Sun Dec 21 21:34:16 GMT 2014

Powered by FUDForum. Page generated in 0.03674 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software