Wrong key binding displayed in MenuItem
- [x] I verified I can reproduce this issue against latest Integration Build of Eclipse SDK
The org.eclipse.ui.bindings extension point allows to define a key sequence for a given commandId in a schemeId:
<key sequence="M2+M3+R"
commandId="org.eclipse.ui.edit.rename"
contextId="org.eclipse.ui.textEditorScope"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
Lets assume that the used commandId is a platform id (for example: org.eclipse.ui.edit.rename)
This commandId has been added to a context menu via this location URI: popup:#TextEditorContext:
<extension point="org.eclipse.ui.menus">
<menuContribution
allPopups="true"
locationURI="popup:#TextEditorContext?after=additions">
<menu id="org.eclipse.lsp4e.menu.refactorings"
label="%refactorings.menu.label">
<command commandId="org.eclipse.ui.edit.rename" style="push" />
<separator name="org.eclipse.lsp4e.refactoringseparator" />
</menu>
The displayed key binding in the context menu does not reflect the correct key binding (see this lsp4e issue #1259), because the contextId is not considered when the MenuItem gets updated here .
If there are more than one binding for a ParameterizedCommand, the first one gets selected after they have been sorted here.
As "F2" is shorter than "M2+M3+R", "F2" is sorted before "M2+M3+R" and gets displayed in the menu entry. This behavior leads to confused users as they expect another key binding in their editor.
Community
- [x] I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
@ghentschke : do you plan to provide a fix?
I would like to. I just look for a way to determine the context id when the MenuItem gets updated. It looks to me that the org.eclipse.e4.ui.bindings.internal.BindingTableManager holds no (direct) information about the context.
@iloveeclipse can you please take a look on my PR #2969