Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311827 - [CommonNavigator] Unable to define tooltip on a CommonViewer
Summary: [CommonNavigator] Unable to define tooltip on a CommonViewer
Status: CLOSED DUPLICATE of bug 223392
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.0   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact: Francis Upton IV CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-06 03:44 EDT by Christophe Fondacci CLA
Modified: 2013-07-18 12:39 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe Fondacci CLA 2010-05-06 03:44:54 EDT
Build Identifier: 3.5.2: 20100218-1602

Trying to add custom tooltips on a common navigator view does not work.

For now, I simply try this :
ColumnViewerToolTipSupport.enableFor(commonViewer)


And the label provider of this common viewer is an extension of CellLabelProvider with proper method definition for tooltip.

The thing is that it does not work. When debugging, I can see a call to ColumnViewerToolTipSupport.shouldCreateToolTip(Event) going till line :

String text = labelProvider.getToolTipText(element);



Everything looks fine except that this labelProvider is not mine. Instead, it is a NavigatorDecoratingLabelProvider which inherit from the default tooltip methods implementation which do nothing.


Reproducible: Always

Steps to Reproduce:
1. Define a common navigator view based on a class extending CommonNavigator
2. Extend the following method :
	@Override
	protected CommonViewer createCommonViewer(Composite aParent) {
		final CommonViewer viewer = super.createCommonViewer(aParent);
		ColumnViewerToolTipSupport.enableFor(viewer);
aParent);
	}
3. Provide a LabelProvider in the common navigator definition which extends CellLabelProvider, overriding these 2 methods :
	@Override
	public boolean useNativeToolTip(Object object) {
		return true;
	}
	@Override
	public String getToolTipText(Object element) {
		return "tooltip";
	}
Comment 1 Ansgar Radermacher CLA 2010-10-18 07:05:54 EDT
I have the same problem. A solution would be to implement the tooltip related functions in the following way (shown for getToolTipText, almost identical for other tooltip related functions):
  if (provider instanceof CellLabelProvider) {
    return ((CellLabelProvider) provider).getToolTipText (element);
  }
  return null;

As a workaround, I use my label provider directly, but I loose existing decoration support in NavigatorDecoratingLabelProvider. I'm currently implementing tool tip support for the model explorer within Papyrus (MDT project) an would really like to see this fixed.
 
Another aspect of the problem (design fault) in this context: the tooltip related methods in CellLabelProvider should have been extracted into an interface, since the application label provider sometimes has to inherit from an existing framework w/o tooltip support (in my case MoDisco) and thus cannot inherit from the CellLabelProvider.
Comment 2 Robin Stocker CLA 2013-07-18 07:22:58 EDT
This seems to be a duplicate of bug 223392.
Comment 3 Francis Upton IV CLA 2013-07-18 12:39:23 EDT
Thanks!
Comment 4 Francis Upton IV CLA 2013-07-18 12:39:51 EDT
Not fixed, dup.

*** This bug has been marked as a duplicate of bug 223392 ***