Search code examples
javaeclipseswttooltipjface

Is it possible to get a Tooltip when hovering over one Cell in a JFace TreeViewer


I have a TreeViewer with three columns. The first column shows the name of an element, the second one property and in the third I would like to display an icon if another property is filled and show that property's content in a tooltip on mouseover, as the property is too much text to display it in the TreeViewer. There seems to be no ITableLabelProvider equivalent for ToolTips so that I could return a tooltip just for my third column.


Solution

  • Tooltip support is available in CellLabelProvider and its subclasses. Note that cell label providers are set to columns (like TreeViewerColumn) and not viewers. ColumnViewerToolTipSupport.enableFor(ColumnViewer viewer) is used to configure tooltips for a viewer.