UndoRetargetAction and UndoAction? [message #172549] |
Fri, 18 March 2005 20:07  |
Eclipse User |
|
|
|
Originally posted by: kevinlouisnospam.hotmail.com
Hi,
What is the difference between these two UndoActions?
The GraphicalEditor#createActions() already add the UndoAction to the
ActionRegistry. Why I still need to addRetargetAction (new
UndoRetargetAction ()) in the ActionBarContributor::buildActions call?
Similarly, DeleteAction is also added in the
GraphicalEditor#createActions(). But I still need to call KeyHandler.put
(KeyStroke.getpressed (SWT.DEL, 127, 0),
getActionRegistry().getAction(ActionFactory.DELETE.getId())) ; to make the
DEL key working.
The ActionBarContributor#setActiveEditor already get the list of Actions
from the ActionRegistry and call the setGlobalActionHandler, why do we need
to do the extra work above?
I find it confusing to do that simple task of ON_COMMAND and
ON_UPDATE_COMMAND_UI tasks.
Thanks,
Kevin.
|
|
|
Re: UndoRetargetAction and UndoAction? [message #172702 is a reply to message #172549] |
Mon, 21 March 2005 10:27  |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
A retarget action is the implementation used for actions which are mapped to
action handlers. The UndoAction is such a handler. So, the
UndoRetargetAction is simply a retarget action which sets its name and icon
for undo.
"Kevin" <kevinlouisnospam@hotmail.com> wrote in message
news:d1ftvu$cbc$1@www.eclipse.org...
> Hi,
>
> What is the difference between these two UndoActions?
>
> The GraphicalEditor#createActions() already add the UndoAction to the
> ActionRegistry. Why I still need to addRetargetAction (new
> UndoRetargetAction ()) in the ActionBarContributor::buildActions call?
ActionBarsContributors are shared across ALL editor instances. No
editor-instance-specific actions can reside there. That's why retargeting
is used.
> Similarly, DeleteAction is also added in the
> GraphicalEditor#createActions(). But I still need to call KeyHandler.put
> (KeyStroke.getpressed (SWT.DEL, 127, 0),
> getActionRegistry().getAction(ActionFactory.DELETE.getId())) ; to make the
> DEL key working.
This is because we cannot define what the DEL key does for all applications.
>
> The ActionBarContributor#setActiveEditor already get the list of Actions
> from the ActionRegistry and call the setGlobalActionHandler, why do we
> need
> to do the extra work above?
Actually, I think that you no longer have to do this. DEL is not grabbed by
the workbench and forwarded to the registered global action handler
|
|
|
Powered by
FUDForum. Page generated in 0.02958 seconds