문제

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...

도움이 되었습니까?

해결책 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).

다른 팁

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top