Question

Greetings fellow Stackoverflownians!

I am building an Eclipse RCP application, and have come across an issue:

I want to set a tooltip text on a TreeItem, but this class does not inherit Control, which is the class that has the setTooltipText

EDIT: It seems that jface is supposed to take care of this seamlessly, through a LabelProvider. I am using a ColumnLabelProvider with getToolTipText method on each column of a complex TreeViewer, but it isn't working. I wonder why...

Was it helpful?

Solution 2

With TreeViewer use

ColumnViewerToolTipSupport.enableFor(viewer);

Use a label provider derived for CellLabelProvider or one of it subclasses and override getToolTipText (there are also several other methods to control the font, time out and the like).

OTHER TIPS

The probleme here is that you use the SWT-Tree. You should use a TreeViewer (JFace) which wraps the tree and gives you more sophisticated options. Inside the label provider of the TreeViewer, you can define your tooltips.

Learn more about viewers here and here

An code example (tool tip) is here

I strongly recommend you to use the viewers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top