Java Code Examples for org.eclipse.ui.forms.widgets.ExpandableComposite#TWISTIE

The following examples show how to use org.eclipse.ui.forms.widgets.ExpandableComposite#TWISTIE . 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: OptionsConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
	ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE
			| ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		@Override
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	expandedComposites.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example 2
Source File: OptionsConfigurationBlock.java    From typescript.java with MIT License 6 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
	ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE,
			ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	fExpandedComposites.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example 3
Source File: ErrorsWarningsPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createProblemCategory(Composite parent, String label) {
  // Expandable panel for each category of problems
  ExpandableComposite expandPanel = new ExpandableComposite(parent, SWT.NONE,
      ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
  expandPanel.setText(label);
  expandPanel.setExpanded(false);
  expandPanel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
  expandPanel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
  expandPanel.addExpansionListener(new ExpansionAdapter() {
    @Override
    public void expansionStateChanged(ExpansionEvent e) {
      topPanel.layout(true, true);
      scrollPanel.setMinSize(topPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    }
  });

  // Create panel to store the actual problems
  Composite categoryPanel = new Composite(expandPanel, SWT.NONE);
  categoryPanel.setLayout(new GridLayout(2, false));
  expandPanel.setClient(categoryPanel);

  return categoryPanel;
}
 
Example 4
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns, Key key) {
	ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	if (key != null) {
		excomposite.setData(key);
	}
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		@Override
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	fExpandableComposites.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example 5
Source File: AppEngineDeployPreferencesPanel.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private void createExpandableComposite() {
  expandableComposite = new ExpandableComposite(this, SWT.NONE, ExpandableComposite.TWISTIE);
  FontUtil.convertFontToBold(expandableComposite);
  expandableComposite.setText(Messages.getString("settings.advanced"));
  expandableComposite.setExpanded(false);
  GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
  gridData.horizontalSpan = 2;
  expandableComposite.setLayoutData(gridData);

  formToolkit.adapt(expandableComposite, true, true);
}
 
Example 6
Source File: AbstractWizardNewTypeScriptProjectCreationPage.java    From typescript.java with MIT License 5 votes vote down vote up
protected ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) {
	ExpandableComposite excomposite= new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
	excomposite.setText(label);
	excomposite.setExpanded(false);
	excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1));
	excomposite.addExpansionListener(new ExpansionAdapter() {
		public void expansionStateChanged(ExpansionEvent e) {
			expandedStateChanged((ExpandableComposite) e.getSource());
		}
	});
	//fExpandables.add(excomposite);
	makeScrollableCompositeAware(excomposite);
	return excomposite;
}
 
Example 7
Source File: AppraiseDiffViewerPart.java    From git-appraise-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent, final FormToolkit toolkit) {
  final List<TaskAttribute> diffTaskAttributes = getDiffTaskAttributes();

  if (diffTaskAttributes == null || diffTaskAttributes.isEmpty()) {
    return;
  }
  int style = ExpandableComposite.TWISTIE | ExpandableComposite.SHORT_TITLE_BAR;
  final Section groupSection = toolkit.createSection(parent, style);
  groupSection.setText("Changes (" + diffTaskAttributes.size() + ')');
  groupSection.clientVerticalSpacing = 0;
  groupSection.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

  if (groupSection.isExpanded()) {
    addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
  } else {
    groupSection.addExpansionListener(new ExpansionAdapter() {
      @Override
      public void expansionStateChanged(ExpansionEvent e) {
        if (groupSection.getClient() == null) {
          try {
            getTaskEditorPage().setReflow(false);
            addDiffViewersToSection(toolkit, diffTaskAttributes, groupSection);
          } finally {
            getTaskEditorPage().setReflow(true);
          }
          getTaskEditorPage().reflow();
        }
      }
    });
  }
}
 
Example 8
Source File: AbstractConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates an expandable section within the parent created previously by
 * calling <code>createSectionComposite</code>. Controls can be added
 * directly to the returned composite, which has no layout initially.
 *
 * @param label the display name of the section
 * @return a composite within the expandable section
 */
public Composite createSection(String label) {
	Assert.isNotNull(fBody);
	final ExpandableComposite excomposite= new ExpandableComposite(fBody, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
	if (fFirstChild == null)
		fFirstChild= excomposite;
	excomposite.setText(label);
	String last= null;
	if (fLastOpenKey != null && fDialogSettingsStore != null)
		last= fDialogSettingsStore.getString(fLastOpenKey);

	if (fFirstChild == excomposite && !__NONE.equals(last) || label.equals(last)) {
		excomposite.setExpanded(true);
		if (fFirstChild != excomposite)
			fFirstChild.setExpanded(false);
	} else {
		excomposite.setExpanded(false);
	}
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));

	updateSectionStyle(excomposite);
	manage(excomposite);

	Composite contents= new Composite(excomposite, SWT.NONE);
	excomposite.setClient(contents);

	return contents;
}
 
Example 9
Source File: AdvancedSettingsComponent.java    From aem-eclipse-developer-tools with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new component.
 * 
 * @param wizardPage
 */
public AdvancedSettingsComponent(final Composite parent,
        final ProjectImportConfiguration propectImportConfiguration,
        final boolean enableProjectNameTemplate,
        SimplerParametersWizardPage wizardPage) {
    super(parent, ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE
            | ExpandableComposite.EXPANDED);
    this.wizardPage = wizardPage;
    setText("Advanced");
    final Composite advancedComposite = new Composite(this, SWT.NONE);
    setClient(advancedComposite);
    addExpansionListener(new ExpansionAdapter() {
        public void expansionStateChanged(ExpansionEvent e) {
            Shell shell = parent.getShell();
            Point minSize = shell.getMinimumSize();
            shell.setMinimumSize(shell.getSize().x, minSize.y);
            shell.pack();
            parent.layout();
            shell.setMinimumSize(minSize);
        }
    });
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginLeft = 11;
    gridLayout.numColumns = 2;
    advancedComposite.setLayout(gridLayout);
    createAdvancedSection(advancedComposite);
}
 
Example 10
Source File: AbstractSection.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new abstract section.
 *
 * @param aEditor the a editor
 * @param parent the parent
 * @param headerText the header text
 * @param description the description
 */
public AbstractSection(MultiPageEditor aEditor, Composite parent, String headerText,
        String description) {
  super(parent, aEditor.getToolkit(), ((null != description) ? Section.DESCRIPTION : 0)
          | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
  toolkit = aEditor.getToolkit();
  getSection().setText(headerText);
  getSection().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  toolkit.createCompositeSeparator(getSection());
  if (null != description)
    getSection().setDescription(description);
  editor = aEditor;
}
 
Example 11
Source File: EnterXMPPAccountComposite.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
public EnterXMPPAccountComposite(Composite composite, int style) {
  super(composite, style);
  super.setLayout(new GridLayout(2, false));

  SarosPluginContext.initComponent(this);

  /*
   * Row 1: JID
   */
  Label jidLabel = new Label(this, SWT.NONE);
  jidLabel.setText(Messages.jid_shortform);

  Combo combo = new Combo(this, SWT.BORDER);
  combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  this.jidCombo = new JIDCombo(combo);

  /*
   * Row 2: Password
   */
  Label passwordLabel = new Label(this, SWT.NONE);
  passwordLabel.setText("Password");

  passwordText = new Text(this, SWT.BORDER);
  passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  passwordText.setEchoChar('*');

  /*
   * Row 3: Server Options
   */
  new Label(this, SWT.NONE);

  serverOptionsExpandableComposite =
      new ExpandableComposite(
          this, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);

  serverOptionsExpandableComposite.setText("Advanced Options");
  serverOptionsExpandableComposite.addExpansionListener(
      new ExpansionAdapter() {
        @Override
        public void expansionStateChanged(ExpansionEvent e) {
          getParent().layout();
        }
      });

  createServerExpandableCompositeContent();

  /*
   * Row 4: Create Account Button
   */

  createAccountButton = new Button(this, SWT.PUSH);
  createAccountButton.setText(Messages.ConfigurationWizard_button_create_account);
  createAccountButton.setVisible(CreateXMPPAccountWizard.CREATE_DIALOG_ENABLED);

  hookListeners();
}
 
Example 12
Source File: SWTFactory.java    From tlaplus with MIT License 3 votes vote down vote up
/**
 * Creates an ExpandibleComposite widget
 * 
 * @param parent the parent to add this widget to
 * @param style the style for ExpandibleComposite expanding handle, and layout
 * @param label the label for the widget
 * @param hspan how many columns to span in the parent
 * @param fill the fill style for the widget
 * Can be one of <code>GridData.FILL_HORIZONAL</code>, <code>GridData.FILL_BOTH</code> or <code>GridData.FILL_VERTICAL</code>
 * @return a new ExpandibleComposite widget
 */
public static ExpandableComposite createExpandibleComposite(Composite parent, String label, int hspan, int fill) {
	ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
	ex.setText(label);
	ex.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
	GridData gd = new GridData(fill);
	gd.horizontalSpan = hspan;
	gd.grabExcessHorizontalSpace = true;
	ex.setLayoutData(gd);
	return ex;
}