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

The following examples show how to use org.eclipse.ui.forms.widgets.ExpandableComposite#COMPACT . 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: AppraiseDiffViewerPart.java    From git-appraise-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates an individual diff viewer in the given composite.
 */
private void createDiffViewer(final FormToolkit toolkit, Composite composite,
    final TaskAttribute diffTaskAttribute) {

  int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
      | ExpandableComposite.COMPACT;
  ExpandableComposite diffComposite = toolkit.createExpandableComposite(composite, style);
  diffComposite.clientVerticalSpacing = 0;
  diffComposite.setLayout(new GridLayout());
  diffComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  diffComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE));
  diffComposite.setText(calculateDiffChangeHeader(diffTaskAttribute));

  final Composite diffViewerComposite = toolkit.createComposite(diffComposite);
  diffComposite.setClient(diffViewerComposite);
  diffViewerComposite.setLayout(
      new FillWidthLayout(EditorUtil.getLayoutAdvisor(getTaskEditorPage()), 15, 0, 0, 3));

  diffComposite.addExpansionListener(new ExpansionAdapter() {
    @Override
    public void expansionStateChanged(ExpansionEvent event) {
      expandCollapseDiff(toolkit, diffViewerComposite, diffTaskAttribute, event.getState());
    }
  });
  GridDataFactory.fillDefaults().grab(true, false).applyTo(diffComposite);
}
 
Example 2
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 3
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);
}