org.eclipse.ui.forms.events.IExpansionListener Java Examples

The following examples show how to use org.eclipse.ui.forms.events.IExpansionListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FormHelper.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * Constructs a section and returns a section client composite
 * 
 * the section layout is TableWrapLayout
 * 
 * 
 * @param parent parent container for the section
 * @param title title of the section
 * @param description description of the section
 * @param toolkit toolkit to create the composite
 * @param sectionFlags parameters of the section
 * @param expansionListener 
 * @return a section client (the content container of the section)
 */
public static Section createSectionComposite(Composite parent, String title, String description,
        FormToolkit toolkit, int sectionFlags, IExpansionListener expansionListener)
{
    final Section section = toolkit.createSection(parent, sectionFlags);

    section.setData(SECTION_IS_NOT_SPACE_GRABBING, new Object());
    section.setText(title);
    section.setDescription(description);

    if (expansionListener != null)
    {
        section.addExpansionListener(expansionListener);
    }

    // create section client
    Composite sectionClient = toolkit.createComposite(section);
    TableWrapLayout layout = new TableWrapLayout();
    layout.numColumns = 1;
    sectionClient.setLayout(layout);
    section.setClient(sectionClient);

    // draw flat borders
    toolkit.paintBordersFor(sectionClient);
    return section;
}
 
Example #2
Source File: PipelineOptionsFormComponent.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private ExpandableComposite optionsTypeSection(PipelineLaunchConfiguration launchConfiguration,
    String optionsTypeName, Collection<String> optionsTypeProperties,
    Map<String, Optional<String>> optionsDescriptions, int style) {
  ExpandableComposite expandable = formToolkit.createSection(form.getBody(), style);
  expandable.setLayout(new GridLayout());
  expandable.setBackground(parent.getBackground());
  expandable.setForeground(parent.getForeground());
  expandable.setText(optionsTypeName);
  expandable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

  LabeledTextMapComponent typeArgs = new LabeledTextMapComponent(formToolkit, expandable,
      new GridData(SWT.FILL, SWT.CENTER, true, false), argumentSeparator);

  for (ModifyListener modifyListener : modifyListeners) {
    typeArgs.addModifyListener(modifyListener);
  }
  for (IExpansionListener expandListener : expansionListeners) {
    expandable.addExpansionListener(expandListener);
  }
  for (String property : optionsTypeProperties) {
    typeArgs.addLabeledText(property, optionsDescriptions.get(property));
  }

  optionsComponents.put(expandable, typeArgs);
  expandable.setClient(typeArgs.getControl());
  typeArgs.setTextValuesForExistingLabels(launchConfiguration.getArgumentValues());

  return expandable;
}
 
Example #3
Source File: BasicFormPage.java    From tlaplus with MIT License 5 votes vote down vote up
public IExpansionListener getExpansionListener()
{
    if (this.formRebuildingListener == null)
    {
        this.formRebuildingListener = new ExpansionAdapter() {
            public void expansionStateChanged(ExpansionEvent e)
            {
                getManagedForm().reflow(true);
            }
        };
    }
    return this.formRebuildingListener;
}
 
Example #4
Source File: PipelineOptionsFormComponent.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
public void addExpandListener(IExpansionListener expandListener) {
  for (ExpandableComposite expandable : optionsComponents.keySet()) {
    expandable.addExpansionListener(expandListener);
  }
  expansionListeners.add(expandListener);
}