Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 475858 - [api] TVT_IES45_JDT: Command name with "Command (&M)"-style mnemonic should not be reused as tooltip
Summary: [api] TVT_IES45_JDT: Command name with "Command (&M)"-style mnemonic should n...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.8 M4   Edit
Assignee: Niraj Modi CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 527028
  Show dependency tree
 
Reported: 2015-08-26 02:09 EDT by pan xiaobing CLA
Modified: 2017-12-06 06:03 EST (History)
10 users (show)

See Also:


Attachments
shared string (28.63 KB, image/gif)
2015-08-26 02:09 EDT, pan xiaobing CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description pan xiaobing CLA 2015-08-26 02:09:28 EDT
Created attachment 256116 [details]
shared string

Description: 
Mnemonic key is useless in tooltip text.
It seems the text is shared with other UI string which requires mnemonic key setting.

For example of there is only one PII string of "Show Failures Only" in WSW45AAP001 and there is mnemonic key setting with "&".
TestRunnerViewPart_show_failures_only=Show &Failures Only

PII strings needs to be separated for each two cases.
In this place no need mnemonic key.

Steps:
Double Click eclipse.exe
Click Window -> Show View -> Others...
Expand Java -> JUnit
Click OK button
Hover the "Show Skipped Tests Only" icon 


Build label: 20150820-0900-Runtime-win64
Language: Japanese and others language

TCT:
https://www-607.ibm.com/software/globalization/translationcommunications/BaseServlet.wss?taskName=ReadArticlePre&arrefnum=7701817298&prrefnum=2000005978
Comment 1 Markus Keller CLA 2015-08-27 16:46:20 EDT
In languages using a latin script, this is not a problem and not even visible.

E.g. org.eclipse.swt.widgets.ToolItem#setToolTipText(String) says:
* The mnemonic indicator (character '&') is not displayed in a tool tip.

=> Only visible in languages where memonics are not taken from the label text but appended in parentheses like "(&M)".

We can either fix these issues in SWT by making Widget#fixMnemonic(String) remove such mnemonics as well. Or we fix the problems client-side and add a note to all #setToolTipText(String) APIs that clients shouldn't rely on that feature because it doesn't work for all scripts.

I found another instance of this problem in PDE source editors here: org.eclipse.pde.internal.ui.editor.actions.HyperlinkAction#generateActionText()
Comment 2 Markus Keller CLA 2016-07-19 10:47:44 EDT
Moving to SWT. All #setToolTipText(String) APIs should make sure that CJK-style mnemonics of the form " (&C)" at the end of the tooltip text are not shown in tooltips (for any character "C").

The only reasonable intention behind dropping the mnemonics in setToolTipText(..) is to allow the reuse of a label as a tooltip. If CJK-style mnemonics are not supported, this effectively makes the feature useless for translated products.

The fix may require implementations to use Widget#fixMnemonic(..) in more situations than before (i.e. also in cases where mnemonics were already dropped by the native widget).
Comment 3 Lakshmi P Shanmugam CLA 2017-03-24 05:47:50 EDT
Niraj, can you please take a look at this for 4.7?
Comment 4 Niraj Modi CLA 2017-05-16 05:28:38 EDT
I could reproduce this issue at my end, by installing Japanese language pack from below update site:
http://download.eclipse.org/technology/babel/update-site/R0.14.1/neon
and launch eclipse with -nl ja option.

I have a working fix for this problem, will share a gerrit patch shortly.
Comment 5 Eclipse Genie CLA 2017-05-16 05:30:42 EDT
New Gerrit change created: https://git.eclipse.org/r/97197
Comment 6 Niraj Modi CLA 2017-05-16 07:51:52 EDT
(In reply to Eclipse Genie from comment #5)
> New Gerrit change created: https://git.eclipse.org/r/97197

Hi Markus,
Will you be able to review above patch for Oxygen RC1 ?
Comment 7 Markus Keller CLA 2017-05-16 15:36:00 EDT
The patch looks more or less OK, but RC1 is too late for such a behavior change. The problem is not new at all, and it's not a major issue.

Additional changes for 4.8:
- Javadoc of all #setToolTipText(String) methods should describe the new behavior
- the Widget#fixMnemonic(..) methods that take a "boolean spaces" parameter should be removed. This parameter is false everywhere.
- implement the same on GTK

On the Mac, such mnemoncis don't make sense, but I don't see any code that would remove them. And removing them in general is even harder, since many labels and menu items have additional trailing characters like "Command(&M)...", "Label(&L):". => Mac support would be a separate topic.
Comment 8 Niraj Modi CLA 2017-11-09 01:33:49 EST
(In reply to Markus Keller from comment #7)
> The patch looks more or less OK, but RC1 is too late for such a behavior
> change. The problem is not new at all, and it's not a major issue.
> 
> Additional changes for 4.8:
> - Javadoc of all #setToolTipText(String) methods should describe the new
> behavior
Updated the gerrit with updated JavaDoc for ToolItem#setToolTipText(String).
Will push that shortly.

> - the Widget#fixMnemonic(..) methods that take a "boolean spaces" parameter
> should be removed. This parameter is false everywhere.
Will address these with separate gerrit for JavaDoc changes and above refactoring as required.

> - implement the same on GTK
>
> On the Mac, such mnemoncis don't make sense, but I don't see any code that
> would remove them. And removing them in general is even harder, since many
> labels and menu items have additional trailing characters like
> "Command(&M)...", "Label(&L):". => Mac support would be a separate topic.
Raised bug 527028 for GTK and Over to Lakshmi for evaluating Mac side.
Comment 10 Niraj Modi CLA 2017-11-14 03:19:59 EST
(In reply to Eclipse Genie from comment #9)
> Gerrit change https://git.eclipse.org/r/97197 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=5cd7382e6d7091900bdcc0aff73a38c1ee866d50

Core issue is resolved, verified the above specific fix in latest Build id: I20171113-2000

Need to verify the tooltip behavior with other SWT widgets and will update the JavaDoc for setToolTipText() method accordingly.
Comment 11 Mickael Istria CLA 2017-11-29 11:39:54 EST
(In reply to Niraj Modi from comment #10)
> Need to verify the tooltip behavior with other SWT widgets and will update
> the JavaDoc for setToolTipText() method accordingly.

Should we retarget to M5 or can this be done within a couple of days?
Comment 12 Niraj Modi CLA 2017-12-01 07:12:23 EST
(In reply to Mickael Istria from comment #11)
> (In reply to Niraj Modi from comment #10)
> > Need to verify the tooltip behavior with other SWT widgets and will update
> > the JavaDoc for setToolTipText() method accordingly.
> 
> Should we retarget to M5 or can this be done within a couple of days?
Not expecting major changes here, trying to complete this for M4 itself.
Comment 13 Niraj Modi CLA 2017-12-04 12:14:50 EST
(In reply to Niraj Modi from comment #10)
> (In reply to Eclipse Genie from comment #9)
> > Gerrit change https://git.eclipse.org/r/97197 was merged to [master].
> > Commit:
> > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> > ?id=5cd7382e6d7091900bdcc0aff73a38c1ee866d50
> 
> Core issue is resolved, verified the above specific fix in latest Build id:
> I20171113-2000
> 
> Need to verify the tooltip behavior with other SWT widgets and will update
> the JavaDoc for setToolTipText() method accordingly.

Verified the tool-tip behavior for CJK-style mnemonics with the other SWT widgets on Windows. Code fix made in comment 9 applies to all the SWT widgets, except for TrayItem widget which already has this behavior via native.

Hence, inline with the ToolItem#setToolTipText(String string) method JavaDoc, similar JavaDoc changes are need for the all SWT widget #setToolTipText method.

Sharing a gerrit shortly.
Comment 14 Eclipse Genie CLA 2017-12-04 12:20:41 EST
New Gerrit change created: https://git.eclipse.org/r/112826
Comment 16 Niraj Modi CLA 2017-12-04 12:38:07 EST
Resolving now.
Comment 17 Niraj Modi CLA 2017-12-06 06:03:18 EST
Verified using Eclipse Build id: I20171205-2000 on Win7 for Japanese language.