[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: Undo with keyboard

I found the problem ...

the undo action wasn t correctly registered in the workbenchadvisor class


Pratik Shah wrote:
Are you saying it works from the menu and not via the keyboard?  I'm
assuming you've registered the ActionBarContributor properly in the
plugin.xml.

"Arnaud" <arnaud@xxxxxxxxxxx> wrote in message
news:cnsf79$c7m$1@xxxxxxxxxxxxxxxxxx

I tried some changes :
I don t bind CTRL + Z and DEL key with the KeyHandler
and I create an ActionBarContributor :

protected void buildActions() {

        IWorkbenchAction
undo=ActionFactory.UNDO.create(getPage().getWorkbenchWindow());
        addRetargetAction((RetargetAction) undo);

        IWorkbenchAction
redo=ActionFactory.REDO.create(getPage().getWorkbenchWindow());
        addRetargetAction((RetargetAction) redo);

        IWorkbenchAction
delete=ActionFactory.DELETE.create(getPage().getWorkbenchWindow());
        addRetargetAction((RetargetAction) delete);
    }


The actionDefinitionId is correctly set, (the key binding is correctly shown in my Edit Menu) but the accelerator CTRL + Z or Del doesnt work...




Randy Hudson wrote:

I'm not sure if those are the correct keystrokes for undo. Have you put

a

breakpoint in handleKeyPressed to see what the event actually is and if

it

gets sent at all?

Undo/Redo are global actions with keybindings associated with the menu
entries. The menu entries might be intercepting the keystrokes (although
I've been told that this isn't the case if the action is disabled).

Either

way, you'll want to register action handlers for those global actions

since

that allows the user to use the menu as well. The same it true for

delete.

KeyHandler is intended for stuff that doesn't appear in menus, although

for

previous version of eclipse DELETE was not stolen by hte edit menu