|
Re: ctrl-c / ctrl-v detection [message #444940 is a reply to message #444178] |
Fri, 24 February 2006 19:11 |
Jeff Magill Messages: 15 Registered: July 2009 |
Junior Member |
|
|
> Both have been hooked with the global action .
>
> bars.setGlobalActionHandler(ActionFactory.COPY.getId(),
> copyAction);
> bars.setGlobalActionHandler(ActionFactory.PASTE.getId(),
> pasteAction);
The copyAction is going to receive the event, not your tree. The
copyAction object should execute the operations you intended to put in
the keyPressed method.
The undo view in the SDK has examples that illustrate this. The undo
example is org.eclipse.ui.examples.undo in the org.eclipse.sdk.examples
plugin. I can't remember if I had to install the standalone examples to
get this or not. Search for "sdk examples" in the help contents of the SDK.
Setting a global action handler seems to mean that no widget in your
view will receive the hotkey events. Once the global action handler
handles the hotkey, the workbench considers that event to be processed
(doit set to false in the Event object). Someone PLEASE correct me if
I'm wrong about this (I would like to be wrong).
This creates a problem in that if you have other widgets in your view
that you would like to receive the hotkeys directly, they won't, because
the global action handler eats those events.
Apparently, the point of the TextActionHandler is to deal with this
issue, but I don't know what the complete solution is (such as for combo
boxes). Also, there is no undo and redo methods on Text so you can't
have both a global action handler and the widgets native local undo
handling.
It seems that setting a global action handler requires that you handle
all the hotkey actions explicitly even if it would make sense from a
user's point of view if the editing history were completely local for
some of the widgets.
Jeff
|
|
|
Powered by
FUDForum. Page generated in 0.03212 seconds