How I got command key-bindings to work for actions [message #276235] |
Fri, 19 November 2004 13:41 |
Eclipse User |
|
|
|
For those posters who, like me, found that calling setActionDefinitionId()
on an Action to associate it with a Command doesn't make the Command's
key-bindings invoke the Action, here's what I did to make it work:
1.
In my EditorActionBarContributor extension, I added a block like the
following, to submit a handler for the action to the workbench:
HandlerSubmission submission = new HandlerSubmission(null, null, null,
command.getId(), new ActionHandler(action), Priority.MEDIUM);
PlatformUI.getWorkbench().getCommandSupport().addHandlerSubm ission(submission);
handlerSubmissions.add(submission);
2.
In the dispose() method of that same class, I added the following:
PlatformUI.getWorkbench().getCommandSupport().removeHandlerS ubmissions(handlerSubmissions);
If you don't do this, the submissions of future instances of your
EditorActionBarContributor extension will conflict with this one.
Hope this helps anyone who, like me, gets stuck on this problem.
--Jeff
|
|
|
Powered by
FUDForum. Page generated in 0.03993 seconds