I am upgrading an old RCP app to use eclipse 2023-06. There are 2 views which are showing doubled vertical scrollbars. Both use TreeViewer.
The part is initialised as follows:
viewer = new TreeViewer(body, SWT.NORMAL | SWT.FULL_SELECTION);
viewer.setContentProvider(new ProtocolViewContentProvider());
viewer.setLabelProvider(lp);
comparator = new ProtocolViewerComparator();
viewer.setComparator(comparator);
viewer.getTree().setLinesVisible(true);
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
I have tried creating the TreeViewer using just the body parameter but there is no change.
If I remove the header the 2 scrollbars are the same height.
SWT Spy does not give me any further insights...
Tree {} [layout=null]@140368
Style: SINGLE | HORIZONTAL | VERTICAL | FULL_SELECTION | LEFT_TO_RIGHT | DOUBLE_BUFFERED
Layout Data: GridData {horizontalAlignment=SWT.FILL grabExcessHorizontalSpace=true verticalAlignment=SWT.FILL grabExcessVerticalSpace=true}
Bounds: Rectangle {0, 27, 1120, 211}
Children:
Peers:
Label {TestCases - [Aktuell] }@140364 Layout Data: GridData {horizontalAlignment=SWT.BEGINNING verticalAlignment=GridData.CENTER} Bounds: Rectangle {0, 0, 130, 17}
*Tree {} [layout=null]@140368 Layout Data: GridData {horizontalAlignment=SWT.FILL grabExcessHorizontalSpace=true verticalAlignment=SWT.FILL grabExcessVerticalSpace=true} Bounds: Rectangle {0, 27, 1120, 211}
Parent Tree:
Shell {gitr3a-workspace-developer - TestCases/5BE86209-DD55-4EA8-9BB7-ECA48CE1D883.cfg - Title} [layout=org.eclipse.e4.ui.workbench.renderers.swt.TrimmedPartLayout@2cf78ff]@1122090
Style: RESIZE | TITLE | CLOSE | MIN | MAX | LEFT_TO_RIGHT
Bounds: Rectangle {3621, -1337, 1741, 1568}
Layout: org.eclipse.e4.ui.workbench.renderers.swt.TrimmedPartLayout@2cf78ff
LayoutData: null
Composite {} [layout=FillLayout {type=SWT.HORIZONTAL}]@1055872
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 28, 1719, 1428}
Layout: FillLayout {type=SWT.HORIZONTAL}
LayoutData: null
Composite {} [layout=org.eclipse.e4.ui.workbench.renderers.swt.SashLayout@5ec40569]@663364
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1719, 1428}
Layout: org.eclipse.e4.ui.workbench.renderers.swt.SashLayout@5ec40569
LayoutData: null
Composite {} [layout=StackLayout {topControl=Composite {} [layout=FillLayout {type=SWT.HORIZONTAL}]}]@791434
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1719, 1428}
Layout: StackLayout {topControl=Composite {} [layout=FillLayout {type=SWT.HORIZONTAL}]}
LayoutData: null
Composite {} [layout=FillLayout {type=SWT.HORIZONTAL}]@1053782
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1719, 1428}
Layout: FillLayout {type=SWT.HORIZONTAL}
LayoutData: null
Composite {} [layout=org.eclipse.e4.ui.workbench.renderers.swt.SashLayout@419a1073]@986112
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1719, 1428}
Layout: org.eclipse.e4.ui.workbench.renderers.swt.SashLayout@419a1073
LayoutData: null
CTabFolder {} [layout=org.eclipse.swt.custom.CTabFolderLayout@7aa5596f]@663188
Style: MULTI | TOP | BORDER | NO_REDRAW_RESIZE | LEFT_TO_RIGHT | DOUBLE_BUFFERED
Bounds: Rectangle {579, 1153, 1140, 275}
Layout: org.eclipse.swt.custom.CTabFolderLayout@7aa5596f
LayoutData: null
Composite {} [layout=FillLayout {type=SWT.HORIZONTAL}]@664042
Style: LEFT_TO_RIGHT
Bounds: Rectangle {10, 26, 1120, 238}
Layout: FillLayout {type=SWT.HORIZONTAL}
LayoutData: null
ContributedPartRenderer$1 {} [layout=FillLayout {type=SWT.VERTICAL}]@598508
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1120, 238}
Layout: FillLayout {type=SWT.VERTICAL}
LayoutData: null
Composite {} [layout=FillLayout {type=SWT.HORIZONTAL}]@1188326
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1120, 238}
Layout: FillLayout {type=SWT.HORIZONTAL}
LayoutData: null
Composite {} [layout=GridLayout {makeColumnsEqualWidth=true horizontalSpacing=5 verticalSpacing=10}]@1776752
Style: LEFT_TO_RIGHT
Bounds: Rectangle {0, 0, 1120, 238}
Layout: GridLayout {makeColumnsEqualWidth=true horizontalSpacing=5 verticalSpacing=10}
LayoutData: null
Here is an example which demonstrates the problem:
@Override
public void createPartControl(Composite parent) {
Composite panel = new Composite(parent, 0);
panel.setLayout(new FillLayout());
viewer = new TreeViewer(panel);
viewer.setContentProvider(new ITreeContentProvider() {
@Override
public Object[] getChildren(Object parentElement) {
return new Object[0];
}
@Override
public Object getParent(Object element) {
return null;
}
@Override
public boolean hasChildren(Object element) {
return false;
}
@Override
public Object[] getElements(Object inputElement) {
if(inputElement instanceof Integer[]) {
return (Object[]) inputElement;
}
return new Object[0];
}
});
final TreeViewerColumn viewerColumn = new TreeViewerColumn(viewer, SWT.NONE);
viewerColumn.setLabelProvider(new CellLabelProvider() {
@Override
public void update(ViewerCell cell) {
cell.setText(cell.getElement().toString());
}
});
final TreeColumn column = viewerColumn.getColumn();
column.setText("HEADER");
column.setWidth(150);
Integer[] content = new Integer[] {1,2,3,4,5,6,7,8,9,0};
viewer.setInput(content);
viewer.getTree().setHeaderVisible(true);
}
(When creating this example, I noticed that the problem appeared after I added a column. With no specific columns only one scrollbar is shown)
What might be causing this?

I am using 2 monitors: the notebook and a 32" screen. The first scales to 100%, the second to 150%.
If I move the app from the second to the first, the app renders correctly.
I altered the windows configuration to scale screen 2 at 100% and the app renders correctly on both screens.
This explains the dodgy rendering but not sure how to handle this for all the different workstations where the app will be deployed...