|
|
|
Re: Add an action to both main menu & view context menu [message #329248 is a reply to message #329194] |
Tue, 17 June 2008 12:42 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
hao wrote:
> Hi Paul,
>
> I like the command and handler approach. Thanks a lot.
>
> I need a little more explanation on your following comments:
>
>> Other than that, you would have to make the Action from your
> ApplicationActionBarAdvisor (of which there is one per workbench window)
> available to your view createPartControl(*) so you can place it in your
> view context menu (assuming you are an RCP app). Or have the same class
> implement both types of I*ActionDelegate needed for the 2 menus. You'll
> get 2 instances of the object, but in different places.
>
> My question is
>
> 1. If I use command and handler approach, do I need to following the
> about comments too?
No, that's what you have to do if you want to use IAction based
(ApplicationActionBarAdvisor) or I*ActionDelegate based
(org.eclipse.ui.actionSets, etc) contributions. The Command+Handler
based approach simply involves creating the command and handler, and
then using org.eclipse.ui.menus/menuContribution to place the commands
in different menus.
> 2. Do you mean I need to make the reference of
> ApplicationActionBarAdvisor available to my View class? Does getSite()
> method help for getting it in my view class?
There's no support for the first IAction based suggestion ... you would
have to code it yourself, potentially storing the needed actions in your
plugin activator (a manager, maybe) and retrieving them from your view.
--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Powered by
FUDForum. Page generated in 0.03485 seconds