| Actions, ActionDelegates, Bindings, Handlers, Commands...huh? [message #9909] |
Thu, 18 May 2006 17:08  |
|
Originally posted by: mark_melvin.amis.com
I am trying to port my application from Eclipse 3.1 to Eclipse 3.2 and I
am running into many little roadblocks and changes in behaviour. One of
them happens to be that my keybindings no longer fire my actions the way
they used to.
In 3.1, I have actions in an action set, combined with an action
delegate. I also have commands and bindings defined, and the actions
are connected to the commands and bindings via the "definitionId"
parameter of the action. It took me awhile to wrap my head around these
three different things in 3.1, but they no longer work in 3.2. Now we
have handlers thrown in there too!
OK, let me get this straight. It looks to me like the latest and
greatest thing now is handlers. So, is this the right thing to do?
1) Define an action in an action set, and hook it up to a command via
the "definitionId" parameter. Do not provide an action delegate, rather
make it retargetable. (This is one extension point).
2) Define a command with a corresponding handler and binding if you want
key bindings (that's three more extension points).
3) Code up the command handler that implements IHandler.
I am left with a few questions:
a) Is this right, or completely wrong?
b) How can I enable/disable my actions in their respective menus like I
used to be able to do in the
org.eclipse.ui.IActionDelegate#selectionChanged method of my action
delegate? If all I have now is an instance of IHandler, how can I
respond to changes in selection to enable/disable menu items?
c) Are there any good articles on this?? There was an EclipseCON
presentation by Douglas Pollock but there is no presentation on the
website. Any idea how to get a-hold of this talk (and hence my cross-post)?
|
|
|
| Re: Actions, ActionDelegates, Bindings, Handlers, Commands...huh? [message #9933 is a reply to message #9909] |
Fri, 19 May 2006 07:43  |
Paul Webster Messages: 6813 Registered: July 2009 Location: Ottawa |
Senior Member |
|
|
Mark Melvin wrote:
> I am trying to port my application from Eclipse 3.1 to Eclipse 3.2 and I
> am running into many little roadblocks and changes in behaviour. One of
> them happens to be that my keybindings no longer fire my actions the way
> they used to.
> In 3.1, I have actions in an action set, combined with an action
> delegate. I also have commands and bindings defined, and the actions
> are connected to the commands and bindings via the "definitionId"
> parameter of the action. It took me awhile to wrap my head around these
> three different things in 3.1, but they no longer work in 3.2. Now we
> have handlers thrown in there too!
Actually, these should indeed work. Because we have no replacement for
actionSets in 3.2, it's still valid to have bindings, commands, and
actionSets if you want your actions to show up in a menu or toolbar.
Handlers are available in 3.1. They serve to attach behaviour (your
action) to a command. But they can't place an action in a menu or
toolbar ... that's why it's not obvious how to disable them.
>
> c) Are there any good articles on this?? There was an EclipseCON
> presentation by Douglas Pollock but there is no presentation on the
> website. Any idea how to get a-hold of this talk (and hence my
> cross-post)?
I was only able to find this:
http://www.magma.ca/~pollockd/despumate.html#eclipsecon2006
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.14175 seconds