Bug 495133 - [GTK2] Content of open Collapsible Groups is not rendered
initially
* Created workaround until swt bug is fixed
Change-Id: Ie19780f29d669642200160e6b1b893ae10bcb9b8
Signed-off-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
diff --git a/bundles/org.eclipse.emf.ecp.view.group.swt.collapsable/src/org/eclipse/emf/ecp/view/group/swt/internal/collapsable/CollapsableGroupSWTRenderer.java b/bundles/org.eclipse.emf.ecp.view.group.swt.collapsable/src/org/eclipse/emf/ecp/view/group/swt/internal/collapsable/CollapsableGroupSWTRenderer.java
index 2da01eb..160a579 100644
--- a/bundles/org.eclipse.emf.ecp.view.group.swt.collapsable/src/org/eclipse/emf/ecp/view/group/swt/internal/collapsable/CollapsableGroupSWTRenderer.java
+++ b/bundles/org.eclipse.emf.ecp.view.group.swt.collapsable/src/org/eclipse/emf/ecp/view/group/swt/internal/collapsable/CollapsableGroupSWTRenderer.java
@@ -102,6 +102,7 @@
final Composite composite = new Composite(bar, SWT.NONE);
GridLayoutFactory.fillDefaults().margins(MARGIN, MARGIN).applyTo(composite);
final ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
+ bar.setInitialHeaderHeight(item0.getHeaderHeight());
final ISWTObservableValue target = WidgetProperties.text().observe(item0);
final IObservableValue modelValue = EMFEditObservables.observeValue(
@@ -182,11 +183,19 @@
private static final class CollapsableGroupExpandBar extends ExpandBar {
private Composite itemComposite;
+ private int headerHeight;
CollapsableGroupExpandBar(Composite parent, int style) {
super(parent, style);
}
+ /**
+ * @param headerHeight the header height
+ */
+ void setInitialHeaderHeight(int headerHeight) {
+ this.headerHeight = headerHeight;
+ }
+
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
return computeSizeForBar(wHint, hHint, changed);
@@ -213,6 +222,12 @@
/* else might be true if the expandbar has a really long group text */
sizeComputedByBar.x = itemSize.x;
}
+ /* workaround for SWT-Bug 430600 */
+ if (getItemCount() == 1 && getItem(0).getHeaderHeight() < 0) {
+ if (itemSize.y + headerHeight > sizeComputedByBar.y && getItem(0).getExpanded()) {
+ sizeComputedByBar.y = itemSize.y + headerHeight;
+ }
+ }
}
return sizeComputedByBar;
}