Skip to content

Commit a44ab90

Browse files
committed
Process deferred layout requests before taking screenshot #1324
When the "expanded" property is set for an ExpandableComposite, the "isLayoutDeferred()" property is set as well. This causes the layout to be done _after_ the screenshot has been taken, meaning that at that point it still has an empty size. As a result, there is no image to show in the designer page. Closes #1324
1 parent a3a8f58 commit a44ab90

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

org.eclipse.wb.os/src/org/eclipse/wb/os/OSSupport.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ protected final Shell layoutShell(Object controlObject) {
153153
protected final Shell layoutShell(Control control) {
154154
Shell shell = control.getShell();
155155
doLayout(shell);
156+
// Implicitly calls `runDeferredLayouts()`
157+
// see https://github.com/eclipse-windowbuilder/windowbuilder/issues/1324
158+
shell.getDisplay().readAndDispatch();
156159
fixZeroSizes_begin(shell);
157160
return shell;
158161
}

org.eclipse.wb.tests/src/org/eclipse/wb/tests/designer/rcp/model/forms/ExpandableCompositeTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public Test() {
106106
}
107107
}
108108
}""");
109+
// When the "expanded" property is set, the "isLayoutDeferred()" property is set as well
110+
// See https://github.com/eclipse-windowbuilder/windowbuilder/issues/1324
111+
assertFalse(composite.getBounds().isEmpty(), "Layout not applied on ExpandableComposite");
109112
}
110113

111114
/**

0 commit comments

Comments
 (0)