We have a tool, that has a GUI which contains multiple Sections. In these sections, we have Expandable Composites which are not expanded by default. When we try to expand these composites, the + becomes a -, but it stays closed:
To fix this, I tried to add an ExpansionListener:
ExpandableComposite extendedConfiguration = getToolkit().createExpandableComposite(parent, TREE_NODE);
extendedConfiguration.setLayoutData(new GridData(FILL, CENTER, true, false, 2, 1));
extendedConfiguration.setText("Erweiterte Einstellungen");
extendedConfiguration.setExpanded(false);
extendedConfiguration.addExpansionListener(new ExpansionAdapter() {
@Override
public void expansionStateChanged(ExpansionEvent e) {
parent.getParent().getParent().layout();
}
});
Using this dirty bit of code, it works, parent
is the Composite of the parent. The parent of the parent is the Section itself, the parent of the Section is our view. It not only looks stupid, but also is problematic when we want to change our view, as the parent of the parent ... may won't be the right parent.
What is the correct way to layout our view again? How can I force the UI to draw the contents of our ExpandableComposite?