Bug 564840 - [JFace/SWT] TableColumnLayout resize does not work on Mac
Summary: [JFace/SWT] TableColumnLayout resize does not work on Mac
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-01 07:59 EDT by Javier Martin CLA
Modified: 2020-08-31 06:41 EDT (History)
0 users

See Also:


Attachments
Output of example program showing widths and column types, in Windows and Mac (208.71 KB, image/png)
2020-07-01 07:59 EDT, Javier Martin CLA
no flags Details
Test program, requires SWT and JFace (2.50 KB, application/octet-stream)
2020-07-01 08:07 EDT, Javier Martin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Martin CLA 2020-07-01 07:59:16 EDT
Created attachment 283470 [details]
Output of example program showing widths and column types, in Windows and Mac

When a column is manually resized in a Table widget handled by TableColumnLayout in macOS, _all_ columns stop resizing.

This seems to be caused by the implementation of JFace TableColumnLayout and its parent AbstractColumnLayout. When they get a column resize event, they do the following:

1. If there is already an "update in process", return
2. If the column being resized was expandable (it had ColumnWeightData), make it fixed (ColumnPixelData)
3. Recompute the size of all other columns
4. Set the "update in process" flag to TRUE
5. Set the new sizes through setColumnWidths, which calls TableColumn.setWidth
6. Unsetting the "update in process" flag

This relies on the assumption that the Resize events caused by point 5 will come _before_ point 6. This does happen in Windows, but not in macOS, _at least_ since version 4.11 of Eclipse and up to 4.16. Instead, the events are parsed _afterwards_ when "update in process" is again FALSE, which causes every single column to go through point 2... which makes all columns fixed in size as soon as the first manual resize happens.

NOTE: I've marked this as a bug in JFace because it's the immediate cause, but that code is 13 years old, so this might also be a symptom of a bug/change in SWT for macOS.
Comment 1 Javier Martin CLA 2020-07-01 08:07:28 EDT
Created attachment 283471 [details]
Test program, requires SWT and JFace
Comment 2 Rolf Theunissen CLA 2020-07-02 15:03:17 EDT
scrollable.update() is called before inupdateMode is set to false. The SWT documentation states that this 'Forces all outstanding paint requests for the widget to be processed before this method returns'

Seems that the issue is rooted in SWT.
Comment 3 Javier Martin CLA 2020-08-31 06:41:55 EDT
Any comment from the SWT people? This bug basically makes the mechanism for auto-resizing of Table columns useless in Mac.