From 9fa60ff118d23cc90836ccf6bc2528936e665a94 Mon Sep 17 00:00:00 2001 From: Maximilian Wittmer Date: Tue, 5 Sep 2023 14:21:10 +0200 Subject: [PATCH] Tree.java: correctly escape & in default Tooltip This fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/1075 When TreeColumn's are too small, a ToolTip is displayed on hover to reveal the whole Label of an Item (The WIN32-Docs call them 'Inline ToolTips'). These ToolTips pass through the Composite-ToolTipText-generator which escapes all & in a Text - allowing to reuse Text from Buttons as Tooltips. This is a well documented Feature of setToolTipText. Since TreeItem's Label does not have Mnemonics, we do not assume that the & needs escaping. This Commit Escapes all & in default Tooltips that are handled by the default mechanism. --- .../Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java index 13d5eae347..e2d59d2bef 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java @@ -5608,7 +5608,7 @@ String toolTipText (NMTTDISPINFO hdr) { } //TEMPORARY CODE if (isCustomToolTip ()) text = " "; - if (text != null) return text; + if (text != null) return text.replace("&", "&&"); } } return super.toolTipText (hdr);