Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 407511 - Tooltips not reliably shown on truncated view titles
Summary: Tooltips not reliably shown on truncated view titles
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.4 M3   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 413538
  Show dependency tree
 
Reported: 2013-05-08 05:31 EDT by Dave Nice CLA
Modified: 2013-10-31 05:10 EDT (History)
5 users (show)

See Also:
pwebster: review+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Nice CLA 2013-05-08 05:31:36 EDT
I downloaded Eclipse 4.3M7 SDK. I ran it and switched to the Resource perspective.

I shrank the project explorer and outline pane until both view titles were truncated.
I hovered over each title - a tooltip is not shown for Outline.

I do the same in Eclipse 3.6.2 and a tooltip is shown.
Comment 1 Eric Moffatt CLA 2013-05-09 15:57:58 EDT
It's possible that we're not actually setting the tooltip for the views in Eclipse 4. The tooltip you see for the Package Explorer likely says something like "Workspace" no ?

It doesn't appear to me that whether the label is completely visible or not makes a difference (i.e. I don't get a tooltip for the Outline view regardless of how wide the stack is...).

I could add the tooltip back, making it only show or not based on whether or not the label gets completely drawn is a fair bit harder...

Daniel, check where we actually construct the new MPlaceholder for a newly opening part to see if we're setting the attribute in the model or not. Note that if we go this route we'll also have to update the ModeledPageLayout code to match setting the tooltip on creation...
Comment 2 Dave Nice CLA 2013-05-13 11:22:23 EDT
Hi Eric,

Thanks for looking at this. That's really interesting.

We have an abstract class for the bulk of our views called ResourcesView. We definitely don't set tooltips on that one, and didn't in the old version of our product based on 3.6.2. Nevertheless, there was a tooltip once the title was truncated (but no tooltip if the title wasn't truncated).

I've tried setting the tooltip in the init method of our abstract class in Eclipse 4.2.2 and now we get a tooltip whether or not the title is truncated.

This is a useful workaround for us but obviously only applies to the views we have control of.
Comment 3 Eric Moffatt CLA 2013-05-13 16:19:28 EDT
Bogdan, was the show / no show of the tooltip something that the old CTF handled but not the new one ?
Comment 4 Eric Moffatt CLA 2013-05-16 10:02:37 EDT
My understanding is that this was handled 'internally' by the CTabFolder implementation. If I'm wrong in this just pass the defect back with comments...
Comment 5 Bogdan Gheorghe CLA 2013-05-16 11:25:48 EDT
I can replicate this behavior in the 4.3 but I see the same behavior in 3.7.2. (ie. no Outline tooltip).

The problem is that no one is setting the tooltip for Outline - for the Package Explorer StackRenderer.createTab sets the tooltip text from the part:

cti.setToolTipText(part.getLocalizedTooltip());

I'm think we need to add the "Outline" string to the part and all will be well.

Back to you!
Comment 6 Daniel Rolka CLA 2013-05-16 12:07:36 EDT
(In reply to comment #5)
> I can replicate this behavior in the 4.3 but I see the same behavior in
> 3.7.2. (ie. no Outline tooltip).
> 
> The problem is that no one is setting the tooltip for Outline - for the
> Package Explorer StackRenderer.createTab sets the tooltip text from the part:
> 
> cti.setToolTipText(part.getLocalizedTooltip());
> 
> I'm think we need to add the "Outline" string to the part and all will be
> well.
> 
> Back to you!

It works in this way that when tooltip is set to the null value then the SWT handles it internally (like it works in the 3.x i.e. for the 'Outline' view). 
Currently for the 'Outline' we set not null but empty tooltip (length == 0) and the default SWT behaviour is disabled. It seems to be some regression on our site or the SWT one. However I would skip it as the SWT bug, like Eric suggested - they should consider the null and empty values the same and process the default behaviour for such cases.

We can temporarily use workaround for that if you want - http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=34a6b1183be187ca514ee27bb421ceadd7513744 

thanks,
Daniel
Comment 7 Bogdan Gheorghe CLA 2013-05-16 12:28:14 EDT
The problem is that we are setting "" instead  of null. As per the CTI javadoc, null is what you want to pass to show the default tooltip (which is what you want to get the truncated behavior):

 * Sets the receiver's tool tip text to the argument, which
 * may be null indicating that the default tool tip for the 
 * control will be shown.

Passing "", means show "" (which is what we are doing).

Patch looks OK, could probably inline it.
Comment 8 Eric Moffatt CLA 2013-05-16 13:20:33 EDT
Pushed a fox to Gerrit:

 https://git.eclipse.org/r/12890

This just makes the default tooltip null instead of an empty string, allowing the CTF's default behavior to work again...
Comment 9 Dave Nice CLA 2013-07-17 05:32:55 EDT
Is it possible to get this integrated for Eclipse 4.4, please?
Comment 10 Dave Nice CLA 2013-07-17 05:54:11 EDT
Or actually a service refresh of 4.3 would be even better :-)
Comment 12 Daniel Rolka CLA 2013-08-07 03:54:18 EDT
Verified in the build: I20130805-2000
Comment 13 Paul Webster CLA 2013-10-29 17:08:27 EDT
We caused an API breakage with this fix, org.eclipse.ui.IWorkbenchPart.getTitleToolTip() says it never returns null

PW
Comment 14 Dani Megert CLA 2013-10-30 05:38:50 EDT
(In reply to Paul Webster from comment #13)
> We caused an API breakage with this fix,
> org.eclipse.ui.IWorkbenchPart.getTitleToolTip() says it never returns null
> 
> PW

Reverted the fix with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d5c990436eb4ab341de6b552a592ef9dd43b0525

and fixed it with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=ed37f1c040bbbd54e6511dd7b5b09df50a73a488
Comment 15 Paul Webster CLA 2013-10-30 10:33:22 EDT
Update slightly outdated tests.  "" in the model tooltip should equal null in the CTabItem tooltip.  http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=20f1140d9c9690f75122b893d6f11b137d629c4e

PW
Comment 16 Dani Megert CLA 2013-10-31 05:10:23 EDT
Verified in I20131030-2000.