Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333508

Summary: Grid: support different truncation styles [with patch]
Product: z_Archived Reporter: Hannes Erven <hannes>
Component: NebulaAssignee: Laurent CARON <laurent.caron>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: cgross, laurent.caron
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://github.com/eclipse/nebula/pull/173
Whiteboard:
Attachments:
Description Flags
Suggested patch none

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