Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Retarget Action and Handler
Retarget Action and Handler [message #328711] Mon, 02 June 2008 16:10 Go to next message
Marco  Lehmann-Mörz is currently offline Marco Lehmann-MörzFriend
Messages: 53
Registered: July 2009
Member
Hi all,

we have to use retarget actions (cut, copy, etc.) from ActionFactory in
the ActionBarAdvisor of our Application for several reason. Until know
we registered a global action handler through
IViewSite.getActionBars().setGlobalActionHandler() and everything works
as expected (e.g. enablement of 'cut' in the main toolbar).
Now I want to use the handler service to activate my handler, because of
an embedded control that runs either in a view or in a dialog. So I take
the handler service from IViewSite.getService() and give to the embedded
control which activates the handler (e.g. for cut). In the local context
menu of the embedded control a command contribution item is used to add
cut, copy, etc. and it works as expected, but in the main menu and the
main toolbar the enablement state of the retarget actions does not change.

What is right way to use retarget actions with handlers?


TIA,
Marco
Re: Retarget Action and Handler [message #328926 is a reply to message #328711] Fri, 06 June 2008 18:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The retarget actions in the main menu only re-act properly when they see
IActions provided through IActionBars#setGlobalActionHandler(*).

PW


--
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


Re: Retarget Action and Handler [message #329034 is a reply to message #328926] Tue, 10 June 2008 19:53 Go to previous messageGo to next message
Marco  Lehmann-Mörz is currently offline Marco Lehmann-MörzFriend
Messages: 53
Registered: July 2009
Member
Hello Paul,

that's a pity. After some research, a wrapped (via delegate)
org.eclipse.ui.internal.actions.CommandAction did the trick.
Is there hope for better "legacy" support?

CU,
Marco


BTW, kudos for the Menu Contributions.


Paul Webster schrieb:
> The retarget actions in the main menu only re-act properly when they see
> IActions provided through IActionBars#setGlobalActionHandler(*).
>
> PW
>
>
Re: Retarget Action and Handler [message #329140 is a reply to message #329034] Fri, 13 June 2008 16:58 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Marco Lehmann wrote:
> Hello Paul,
>
> that's a pity. After some research, a wrapped (via delegate)
> org.eclipse.ui.internal.actions.CommandAction did the trick.
> Is there hope for better "legacy" support?

if someone writes it, sure :-) But while there is support on the
command side for dealing with actions, there is limited opportunity to
do the same thing in the action code (it is much older, and hence more
stable/brittle).

There's hope for migration off of the legacy dependencies, for example
in 3.4 the WorkbenchActionBuilder doesn't use the RetargetActions from
ActionFactory (which remain available in ActionFactory for API reasons).
Instead a CommandContributionItem is used for most of the
RetargetAction menu items (like cut, copy, paste, print, etc), which
responds to the command enabled state (where it is a true handler or an
action wrapped in a handler-bridge). All that to say
CommandContributionItems work with actions and handlers, but
RetargetActions don't work nearly as well with commands.

PW



--
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


Previous Topic:P2 updater problem
Next Topic:Force a plugin to re-start
Goto Forum:
  


Current Time: Wed Jul 17 12:15:38 GMT 2024

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

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

Back to the top