Skip to content

Commit 340306e

Browse files
Maximilian Wittmerakurtakov
authored andcommitted
Tree.java: correctly escape & in default Tooltip
This fixes eclipse-platform/eclipse.platform.ui#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.
1 parent fc94eaf commit 340306e

File tree

1 file changed

+1
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+1
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Tree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5646,7 +5646,7 @@ String toolTipText (NMTTDISPINFO hdr) {
56465646
if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) {
56475647
String text = null;
56485648
if (index [0] == 0) {
5649-
text = item [0].text;
5649+
text = item [0].text.replace("&", "&&");
56505650
} else {
56515651
String[] strings = item [0].strings;
56525652
if (strings != null) text = strings [index [0]];

0 commit comments

Comments
 (0)