Bug 405718 - Use case for mnemonics text field in menus and bars unclear
Summary: Use case for mnemonics text field in menus and bars unclear
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 419823 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-15 08:30 EDT by Markus Kuppe CLA
Modified: 2021-02-13 06:15 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Kuppe CLA 2013-04-15 08:30:24 EDT
The mnemonics text field doesn't seem to have any effects on the e4 application. Defining mnemonics (e.g. &File) works if set as part of the label string though. Thus, what is the purpose of the mnemonics text field?
Comment 1 Nobody - feel free to take it CLA 2013-04-17 04:35:48 EDT
Since we correctly set the field in the tooling part I'm moving this to platform/UI for a hint on the usecase.
Comment 2 Paul Webster CLA 2013-04-17 07:43:54 EDT
Setting the mnemonic in a MMenuItem should auto-apply it when it appears in a menu item.  But if it's not working, we need to take a look at it.  It should work the same was as the mnemonic attribute in the org.eclipse.ui.menus extension point.

See the code in org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.updateMenuItem()

if (text != null) {
	if (model instanceof MMenuElement) {
		String mnemonics = ((MMenuElement) model).getMnemonics();
		if (mnemonics != null) {
			int idx = text.indexOf(mnemonics);
			if (idx != -1) {
				text = text.substring(0, idx) + '&'
						+ text.substring(idx);
			}
		}
	}
	if (keyBindingText == null)
		item.setText(text);
	else
		item.setText(text + '\t' + keyBindingText);
} else { ...

PW
Comment 3 Lars Vogel CLA 2019-01-09 08:30:09 EST
*** Bug 541845 has been marked as a duplicate of this bug. ***
Comment 4 Eclipse Genie CLA 2020-12-30 14:33:02 EST Comment hidden (obsolete)
Comment 5 Rolf Theunissen CLA 2021-02-13 06:14:20 EST
The support for using mnemonics in the label attribute as well as having a separate mnemonic definition causes confusion. The same confusion is present with the org.eclipse.ui.menus extension point, see also Bug 570722. There was a clear design decision to separate the two, see the documentation of the extension point, however this separation was never enforced.

Changing this behavior now would cause many regressions, especially for the extension case. 
Do we want to depreciate one of the mechanisms? Or at least make clear which of the two mechanisms is preferred?
Comment 6 Rolf Theunissen CLA 2021-02-13 06:15:14 EST
*** Bug 419823 has been marked as a duplicate of this bug. ***