Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333508 - Grid: support different truncation styles [with patch]
Summary: Grid: support different truncation styles [with patch]
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Laurent CARON CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-04 14:57 EST by Hannes Erven CLA
Modified: 2021-07-05 11:40 EDT (History)
2 users (show)

See Also:


Attachments
Suggested patch (17.34 KB, patch)
2011-01-04 14:58 EST, Hannes Erven CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hannes Erven CLA 2011-01-04 14:57:30 EST
Build Identifier: HEAD

Currently, the Grid compontent truncates any cell content "in the middle" and shows an equal number of characters to the left and right of the pivot point.
However, the standard SWT TreeViewer widget cuts off content at the end.

e.g. "demo content" -->
GRID:  |dem...ent|
TREE:  |demo c...|

Depending on the use case, one or the other may be more useful. I am currently porting an application from TreeViewer to GridTreeViewer and need to maintain a consistent user experience - including truncation at the end.

I'll attach a patch that adds a setTruncationStyle() method to all Renderers. The Renderers ultimately pass that to TextUtils, which I modified to de-duplicate the existing code.

The new code currently proposes three truncation styles:
START:  |...ontent|
MIDDLE: |dem...ent|
END:    |demo c...|

Reproducible: Always
Comment 1 Hannes Erven CLA 2011-01-04 14:58:06 EST
Created attachment 186042 [details]
Suggested patch
Comment 2 Laurent CARON CLA 2019-10-01 12:38:24 EDT
Fixed in Nebula 2.3.0
(my first enhancement on Grid)

Thank to Hannes Erven for the patch. I had to change what Hannes did on TextUtils because the code changes a lot since 2011