Reputation: 643
I am trying to set tooltip for items in a TreeViewer in swt.
ColumnViewerToolTipSupport.enableFor(viewer);
DocumentTreeLabelProvider labelProvider = new DocumentTreeLabelProvider();
viewer.setLabelProvider(new DecoratingLabelProvider(labelProvider, labelProvider));
The labelProvider class looks like this:
public class DocumentTreeLabelProvider extends ColumnLabelProvider implements ILabelDecorator {
...
@Override
public String getToolTipText(Object element) {
return "tooltip"; //$NON-NLS-1$
}
...
}
The problem is that tooltips are never displayed and I have no idea why ??
Upvotes: 2
Views: 507
Reputation: 111142
ColumnViewerToolTipSupport
only looks at the main label provider for the column (DecoratingLabelProvider
in your case).
You will have to use a label provider which supports tool tips for the main label provider, DecoratingStyledCellLabelProvider
for example. Extend that label provider to add the getToolTipText
method.
Upvotes: 1