Java Code Examples for org.eclipse.ui.forms.widgets.FormToolkit#createExpandableComposite()
The following examples show how to use
org.eclipse.ui.forms.widgets.FormToolkit#createExpandableComposite() .
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 |
/** * 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: FormsPart.java From codeexamples-eclipse with Eclipse Public License 1.0 | 6 votes |
private void createSecondSection( ScrolledForm form, FormToolkit toolkit) { ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TREE_NODE| ExpandableComposite.CLIENT_INDENT); ec.setText("Expandable Composite title"); String ctext = "We will now create a somewhat long text so that "+ "we can use it as content for the expandable composite. "+ "Expandable composite is used to hide or show the text using the " + "toggle control"; Label client = toolkit.createLabel(ec, ctext, SWT.WRAP); ec.setClient(client); TableWrapData td = new TableWrapData(); td.colspan = 2; ec.setLayoutData(td); ec.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); }
Example 3
Source File: WidgetFactory.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public static ExpandableComposite createExpandableComposite(final FormToolkit t, final ScrolledForm f, String text){ ExpandableComposite ret = t.createExpandableComposite(f.getBody(), ExpandableComposite.TWISTIE); ret.setText(text); ret.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e){ f.reflow(true); } }); return ret; }
Example 4
Source File: MechanicDialog.java From workspacemechanic with Eclipse Public License 1.0 | 4 votes |
/** * Add a form to the supplied Composite. */ private Control createForm(Composite parent) { final FormToolkit toolkit = new FormToolkit(parent.getDisplay()); final ScrolledForm form = toolkit.createScrolledForm(parent); /* * For the life of me I can't understand why I have to supply * a GridData instance to the form object in order to get the form * to fill the dialog area. * * BTW, I only found this out through trial and error. */ form.setLayoutData(new GridData(GridData.FILL_BOTH)); TableWrapLayout layout = new TableWrapLayout(); layout.numColumns = 2; layout.horizontalSpacing = 15; layout.verticalSpacing = 10; form.getBody().setLayout(layout); form.getBody().setLayoutData(new TableWrapData( TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB, 1, 3)); for (Task item : items) { // add an expandable description of the task, with a pretty title ExpandableComposite ec = toolkit.createExpandableComposite(form.getBody(), ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT); ec.setText(item.getTitle()); Label label = toolkit.createLabel(ec, item.getDescription(), SWT.WRAP); ec.setClient(label); ec.addExpansionListener(new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); ec.setExpanded(true); ec.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); // add a combo box allowing the user to select the repair action to take createDecisionCombo(form.getBody(), item); } return parent; }