diff options
| author | Sravan Kumar Lakkimsetti | 2018-05-16 12:19:37 +0000 |
|---|---|---|
| committer | Sravan Kumar Lakkimsetti | 2018-09-14 08:49:12 +0000 |
| commit | 72c7a218c9727d9f05050c9d47828a82a6978516 (patch) | |
| tree | d2fa698f4507c26cae5c6fd7f9b47aee3f520329 | |
| parent | 4e9fd0e862078e7fbde36de9d8f5413d7fdb83e8 (diff) | |
| download | eclipse.platform.swt-72c7a218c9727d9f05050c9d47828a82a6978516.tar.gz eclipse.platform.swt-72c7a218c9727d9f05050c9d47828a82a6978516.tar.xz eclipse.platform.swt-72c7a218c9727d9f05050c9d47828a82a6978516.zip | |
Bug 527028 - [GTK][api] TVT_IES45_JDT: Command name with "Command
(&M)"-style mnemonic should not be reused as tooltip
Change-Id: Id2771f5614898ac4f902ad9e92df3e2aac8aa063
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
3 files changed, 18 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java index 2518e4608d..fade9b81eb 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java @@ -3329,7 +3329,7 @@ long /*int*/ gtk_enter_notify_event (long /*int*/ widget, long /*int*/ event) { */ byte [] buffer = null; if (toolTipText != null && toolTipText.length() != 0) { - char [] chars = fixMnemonic (toolTipText, false); + char [] chars = fixMnemonic (toolTipText, false, true); buffer = Converter.wcsToMbcs (chars, true); } long /*int*/ toolHandle = getShell().handle; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index 3af079bf92..f590ed13ae 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -2923,7 +2923,7 @@ void setToolTipText (long /*int*/ tipWidget, String string) { void setToolTipText (long /*int*/ rootWidget, long /*int*/ tipWidget, String string) { byte [] buffer = null; if (string != null && string.length () > 0) { - char [] chars = fixMnemonic (string, false); + char [] chars = fixMnemonic (string, false, true); buffer = Converter.wcsToMbcs (chars, true); } long /*int*/ oldTooltip = GTK.gtk_widget_get_tooltip_text (rootWidget); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index f52b743be6..ae93fa000e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -1004,6 +1004,10 @@ char [] fixMnemonic (String string) { } char [] fixMnemonic (String string, boolean replace) { + return fixMnemonic (string, replace, false); +} + +char [] fixMnemonic (String string, boolean replace, boolean removeAppended) { int length = string.length (); char [] text = new char [length]; string.getChars (0, length, text, 0); @@ -1019,6 +1023,18 @@ char [] fixMnemonic (String string, boolean replace) { } i++; break; + /* + * In Japanese like languages where mnemonics are not taken from the + * source label text but appended in parentheses like "(&M)" at end. In order to + * allow the reuse of such label text as a tool-tip text as well, "(&M)" like + * character sequence has to be removed from the end of CJK-style mnemonics. + */ + case '(': + if (removeAppended && i + 4 == string.length () && text [i + 1] == '&' && text [i + 3] == ')') { + if (replace) result [j++] = ' '; + i += 4; + break; // break switch case only if we are removing the mnemonic otherwise fall through + } case '_': if (replace) result [j++] = '_'; //FALL THROUGH |
