title: Two Eclipse UI Form sections that grab excess vertical space and fold properly?
body: <p>I'm trying to create an Eclipse Form that has three foldable sections, one fixed size and two others that should grab all the remaining vertical space in the editor window so, that when one of the bottom sections is folded, the other one would fill all the available space.</p>
  
  <p>I have read the <a href="http://www.eclipse.org/articles/Article-Forms/article.html" rel="nofollow noreferrer" title="Eclipse Forms article">forms article</a>, tried many variations of <code>grabExcessVerticalSpace</code> and <code>SWT.FILL</code>'s and pretty much everything the GridData for the sections has to offer, but with no luck. I've also tried to nest the section clients in composites that would <code>grabExcess...Space</code>, but that does not help either. Calling <code>layout()</code> does not help, the form reflows when the sections are folded, and folding the first section works fine.</p>
  
  <p>Here's the code for a form with three sections, but in which the two bottom sections only give up a tiny part of their space when folded, not all of it as I would like:</p>
  
  <pre><code>import org.eclipse.swt.SWT;
  import org.eclipse.swt.layout.GridData;
  import org.eclipse.swt.layout.GridLayout;
  import org.eclipse.swt.widgets.Composite;
  import org.eclipse.ui.forms.IManagedForm;
  import org.eclipse.ui.forms.SectionPart;
  import org.eclipse.ui.forms.editor.FormEditor;
  import org.eclipse.ui.forms.editor.FormPage;
  import org.eclipse.ui.forms.events.ExpansionAdapter;
  import org.eclipse.ui.forms.events.ExpansionEvent;
  import org.eclipse.ui.forms.widgets.FormToolkit;
  import org.eclipse.ui.forms.widgets.Section;
  
  public class SectionFormPage extends FormPage {
      private IManagedForm managedForm;
  
      public SectionFormPage(FormEditor editor) {
          super(editor, "sectionEditor", "title");
      }
  
      protected void createFormContent(IManagedForm managedForm) {
          this.managedForm = managedForm;
          FormToolkit toolkit = managedForm.getToolkit();
          Composite body = managedForm.getForm().getBody();
  
          body.setLayout(new GridLayout());
  
          createSectionWithButton(toolkit, body, new GridData(SWT.FILL, SWT.FILL, true, false));
          createSectionWithButton(toolkit, body, new GridData(SWT.FILL, SWT.FILL, true, true));
          createSectionWithButton(toolkit, body, new GridData(SWT.FILL, SWT.FILL, true, true));
  
          body.layout();
      }
  
      private void createSectionWithButton(FormToolkit toolkit, final Composite body, final GridData layoutData) {
          Section section = createSection(toolkit, body, "Section");
          section.setLayoutData(layoutData);
          section.setClient(toolkit.createButton(section, "button", SWT.NONE));
      }
  
      private Section createSection(final FormToolkit toolkit, final Composite body, String title) {
          Section section = toolkit.createSection(body, Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
          section.setText(title);
          managedForm.addPart(new SectionPart(section));
          section.addExpansionListener(new ExpansionAdapter() {
              public void expansionStateChanged(ExpansionEvent e) {
                  managedForm.reflow(true);
              }
          });
          return section;
      }
  }
  </code></pre>
  
  <p>Any pointers? Where should that layout even be specified, for the Sections or to their parents, or Clients? Thanks beforehand!</p>