Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 571020 - Longest tree label truncated
Summary: Longest tree label truncated
Status: CLOSED DUPLICATE of bug 568383
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-08 06:31 EST by Ahmed Hussain CLA
Modified: 2021-02-10 11:08 EST (History)
1 user (show)

See Also:


Attachments
Modified SWT Snippet to reproduce problem (2.17 KB, application/octet-stream)
2021-02-08 06:31 EST, Ahmed Hussain CLA
no flags Details
Screenshot of Collapsed Tree (6.45 KB, image/png)
2021-02-08 06:35 EST, Ahmed Hussain CLA
no flags Details
Screenshot after expand first node (9.03 KB, image/png)
2021-02-08 06:35 EST, Ahmed Hussain CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Hussain CLA 2021-02-08 06:31:47 EST
Created attachment 285478 [details]
Modified SWT Snippet to reproduce problem

Labels for the longest/widest node in an SWT Tree seem to get routinely truncated under certain circumstances, on OSX. See the attached code snippet, which is just a slightly tweaked version of Snippet15 from the SWT code samples on the website. The problem actually reproduces fine with the unmodified snippet, but it's a bit easier to see what's going on with this tweak, which makes the width of the node a crude function of its hierarchical position within the tree.

What I think is happening is that when the tree items are expanded/collapsed, the code recomputes the size of the tree but fails to take into account some kind of padding or possibly uses the wrong font metrics. When the tree is rendered, most of it is fine but there is just not *quite* enough space for the widest part of the tree, and is shown truncated (e.g. ABCDE12345 is shown as ABCDE12...). If you expand the tree a little more, then what was previously truncated is now rendered fine, but the new widest node is now truncated.

It doesn't seem to happen all the time - plenty of trees in Eclipse render fine, but it's occurring in some code in the plugin I'm maintaining and I have been unable to shed any light on what triggers it and why. I tried implementing the JFaces label provider approach but it made no difference. As it reproduces easily with a simple code snippet, I'm hoping someone can give a fix or a hint as to a workaround!
Comment 1 Ahmed Hussain CLA 2021-02-08 06:35:17 EST
Created attachment 285479 [details]
Screenshot of Collapsed Tree
Comment 2 Ahmed Hussain CLA 2021-02-08 06:35:53 EST
Created attachment 285480 [details]
Screenshot after expand first node
Comment 3 Lakshmi P Shanmugam CLA 2021-02-09 17:24:40 EST
Thanks for the details. This is caused by some change in BigSur, needs more investigation.

*** This bug has been marked as a duplicate of bug 568383 ***
Comment 4 Ahmed Hussain CLA 2021-02-10 11:08:03 EST
(In reply to Lakshmi P Shanmugam from comment #3)
> Thanks for the details. This is caused by some change in BigSur, needs more
> investigation.

Thanks for the prompt response. I'll monitor the original report. If it only affects Big Sur and only child debug sessions then it's very liveable-with.
Ahmed