Parameterized commands and key bindings [message #734164] |
Thu, 06 October 2011 17:46  |
Eclipse User |
|
|
|
I cannot get the key bindings to show in the drop-down menu that is attached to a toolbar button. If I remove parameters
from my commands, the key shortcuts show in the menu. Put the parameters back, and the bindings disappear. Can anyone
spot anything wrong in the following code?
Commands:
<extension
point="org.eclipse.ui.commands">
<command
defaultHandler="com.abc.ui.handler.PickModePulldownHandler"
description="Description"
id="com.abc.ui.handlers.defaultpickmode"
name="name">
</command>
<command
defaultHandler="com.abc.ui.handler.PickModeHandler"
description="Description"
id="com.abc.ui.handlers.pickmode.deletepick"
name="Delete">
returnTypeId="com.abc.ui.pickmode.commandParameterType">
<commandParameter
id="PICK_MODE_PARAMETER"
name="FBPick mode parameter"
optional="false"
typeId="com.abc.ui.pickmode.commandParameterType"
values="com.abc.ui.handler.PickModeParameterValues">
</commandParameter>
</command>
</extension>
(the first command to be used in the toolbar button, the second command contributes to the attached drop-down menu).
Menus:
<extension
point="org.eclipse.ui.menus">
<menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=abc_editor_additions">
<toolbar id="com.abc.ui.handlers.pickmode.toolbar">
<command
commandId="com.abc.ui.handlers.defaultpickmode"
id="com.abc.ui.handlers.pickmode.pulldown"
icon="icons/elcl16/pickmodeboth.gif"
style="pulldown">
</command>
</toolbar>
</menuContribution>
<menuContribution
locationURI="menu:com.abc.ui.handlers.pickmode.pulldown?after=additions">
<command
commandId="com.abc.ui.handlers.pickmode.deletepick"
label="Delete"
icon="icons/elcl16/pickmodedelete.gif"
style="radio">
<parameter
name="PICK_MODE_PARAMETER"
value="DELETE">
</parameter>
</menuContribution>
</extension>
(the first menu contribution is the toolbar button, the second is the drop-down list item)
And finally the binding:
<extension
point="org.eclipse.ui.bindings">
<key
sequence="D"
contextId="com.abc.ui.editor.FBEditor"
commandId="com.abc.ui.handlers.pickmode.deletepick"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
</key>
</extension>
As I said before, take the <commandParameter> element away, and the binding shows in the drop-down list as the key
shortcut (the letter D).
Is this a known issue, or did I screw it up somewhere?
Thanks,
Alex Molochnikov
Fugro Geoservices Ltd.
|
|
|
Re: Parameterized commands and key bindings [message #753483 is a reply to message #734164] |
Thu, 27 October 2011 08:48  |
Eclipse User |
|
|
|
1) the keybinding takes the parameter into account. If your command menu item has a parameter X, you would only see a keybinding for that command with the parameter set to X. A keybinding for the command with no parameter is treated as a different keybinding.
2) are you looking for a mnemonic instead of a keybinding? Like having the menu item label Delete have it's 'D' underlined?
PW
|
|
|
Powered by
FUDForum. Page generated in 0.11174 seconds