[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: UndoRetargetAction and UndoAction?

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@xxxxxxxxxxx> wrote in message 
news:d1ftvu$cbc$1@xxxxxxxxxxxxxxxxxx
> 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