Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How can I get list of Actions contributed by Plugins?
How can I get list of Actions contributed by Plugins? [message #463950] Tue, 20 February 2007 18:16 Go to next message
Eclipse UserFriend
Originally posted by: jwurst.bbcsinc.com

My application consists of a main menu plus a bunch of plugins--any of which
may or may not be installed at any given time. Each plugin will contribute
an Action to a specific menu/submenu in the base program. I want to be able
to read the the list of loaded actions so that I can also present in a Tree
or some other nice way on the program's startup page. Is this possible? I
haven't been able to get at this information.

Thanks!
Jeff
Re: How can I get list of Actions contributed by Plugins? [message #463980 is a reply to message #463950] Wed, 21 February 2007 10:28 Go to previous messageGo to next message
Eclipse UserFriend
So not easily and it's even harder in 3.3 :-)

you would need to read the extension points that the other plugins are
using to contribute there menu/actions and build the tree for display
purposes.

Later,
PW
Re: How can I get list of Actions contributed by Plugins? [message #463986 is a reply to message #463980] Wed, 21 February 2007 12:20 Go to previous message
Eclipse UserFriend
Originally posted by: jwurst.bbcsinc.com

Thanks! It took some effort to find what I needed but its solved and its all
there... names, id's, icons, tooltips, class names, and that convenient
IContributionItem.createExecutableExtension function that I can use to run
the actions.

For anyone else who may want to know in the future, here is basically what I
did:
IExtensionRegistry er = Platform.getExtensionRegistry();
IExtensionPoint ep = er.getExtensionPoint("org.eclipse.ui.actionSets");
Read all extensions using IExtension[] e = ep.getExtensions();
then for each IExtension do IConfigurationElement[] ce =
e[i].getConfigurationElements();
And for each Configuration Element look at the attributes and their values
as well as their own .getChildren functions that return another list of
Configuration Elements. There is a lot of good data in the attributes for
all of those elements. To run the action find the Configuration Element that
has name="action" and then call
IConfigurationElement.createExecutableExtension("class"); That gives an
instance of the you action class and you can then use the .run function.
Don't call createExecutableExtension until you are ready to run the action
because it will cause the plugin to load.

I guess I'll deal with 3.3 when the time comes...

Jeff

"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:erhoi5$uek$4@utils.eclipse.org...
> So not easily and it's even harder in 3.3 :-)
>
> you would need to read the extension points that the other plugins are
> using to contribute there menu/actions and build the tree for display
> purposes.
>
> Later,
> PW
Previous Topic:Opening fast views
Next Topic:enhanced MessageConsole ?
Goto Forum:
  


Current Time: Mon Mar 17 08:37:45 EDT 2025

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

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

Back to the top