Skip to content

Commit 925be9e

Browse files
Maximilian WittmerMaximilian Wittmer
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 d4a3dad commit 925be9e

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5639,7 +5639,8 @@ String toolTipText (NMTTDISPINFO hdr) {
56395639
if (findCell (pt.x, pt.y, item, index, cellRect, itemRect)) {
56405640
String text = null;
56415641
if (index [0] == 0) {
5642-
text = item [0].text;
5642+
text = new String(item [0].text);
5643+
text = text.replace("&", "&&");
56435644
} else {
56445645
String[] strings = item [0].strings;
56455646
if (strings != null) text = strings [index [0]];

0 commit comments

Comments
 (0)