Class SectionFactory

  • public final class SectionFactory
    extends org.eclipse.jface.widgets.AbstractCompositeFactory<SectionFactory,​Section>
    This class provides a convenient shorthand for creating and initializing Section. This offers several benefits over creating Section normal way: Example usage:
     Section section = SectionFactory.newSection(Section.TWISTIE | Section.DESCRIPTION) //
                    .title("My Section") //
                    .description("My section created with a factory") //
                    .onExpand(event -> sectionExpanded(event)) //

    The above example creates a section with a title, a description, registers an IExpansionListener and finally creates the section in "parent".

     SectionFactory sectionFactory = SectionFactory.newSection(Section.TWISTIE);
     sectionFactory.title("Section 1").create(parent);
     sectionFactory.title("Section 2").create(parent);
     sectionFactory.title("Section 3").create(parent);

    The above example creates three section using the same instance of SectionFactory.