Bug 341865

Summary: TreeColumn.getWidth() returns 0 for unrealized column
Product: [Eclipse Project] Platform Reporter: Dani Megert <daniel_megert>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, Lars.Vogel, markus.kell.r, paul-eclipse, prakash, remy.suen
Version: 3.7Keywords: helpwanted
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 341447    

Description Dani Megert CLA 2011-04-05 02:25:30 EDT
3.7 M6.

TreeColumn.getWidth() returns 0 for an unrealized tree column. This is not mentioned in the Javadoc and hence one could expect that:
    setWidth(w) ==> w == getWidth().

Either we fix getWidth() or improve the Javadoc. In the latter case one needs additional API that allows to tell whether the column was realized or not since testing getWidth() == 0 is not OK as the column could indeed be 0. Such an API would actually be useful on any widget.
Comment 1 Lars Vogel CLA 2019-11-12 08:14:02 EST
ExtendedMarkersView, has the following workaround due to this bug:

viewer.getTree().addPaintListener(new PaintListener() {
			@Override
			public void paintControl(PaintEvent e) {
				treePainted= true;
				viewer.getTree().removePaintListener(this);
			}
		});
Comment 2 Eric Williams CLA 2019-11-12 08:59:22 EST
Is this a Linux issue or does it happen on all platforms?
Comment 3 Lars Vogel CLA 2019-11-12 09:20:23 EST
(In reply to Eric Williams from comment #2)
> Is this a Linux issue or does it happen on all platforms?

Don't know.
Comment 4 Paul Pazderski CLA 2019-11-12 09:43:55 EST
(In reply to Eric Williams from comment #2)
> Is this a Linux issue or does it happen on all platforms?

How do I test this? I disabled the workaround in ExtendedMarkersView and saw no getWidth() == 0 on Windows 7.
Also in Snippet170 column1.getWidth() always returns 200. No matter if immediately after setWidth before or after shell open or in tree paint listener.
Comment 5 Lars Vogel CLA 2019-11-12 09:46:13 EST
Maybe this has been fixed in the last 7 years?