Search in sources :

Example 21 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project titan.EclipsePlug-ins by eclipse.

the class NamingConventionPreferencePage method createExtendableComposite.

/**
 * Creates an expandable composite on the user interface.
 *
 * @param parent
 *                the parent composite where this one can be added to.
 * @param title
 *                the title of the new composite.
 *
 * @return the created composite.
 */
private ExpandableComposite createExtendableComposite(final Composite parent, final String title) {
    final ExpandableComposite ex = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
    ex.setText(title);
    ex.setExpanded(false);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    ex.setLayoutData(data);
    ex.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(final ExpansionEvent e) {
            Composite temp = parent;
            while (temp != null && !(temp instanceof ScrolledComposite)) {
                temp = temp.getParent();
            }
            if (temp != null) {
                Point point = pagecomp.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                ((ScrolledComposite) temp).setMinSize(point);
                ((ScrolledComposite) temp).layout(true, true);
            }
        }
    });
    return ex;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Point(org.eclipse.swt.graphics.Point) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 22 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method setUpExpandableSection.

private void setUpExpandableSection(final Section section, final String prefId, boolean defaultExpanded) {
    section.setExpanded(getStoredExpandedState(prefId, defaultExpanded));
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            if (e.getState()) {
                prefStore.setValue(prefId, IIdeUiConstants.SECTION_EXPANDED);
            } else {
                prefStore.setValue(prefId, IIdeUiConstants.SECTION_COLLAPSED);
            }
            if (isContributedSection(section)) {
                // If we're expanding a contributed section, close the
                // update section...
                updateSection.setExpanded(false);
                prefStore.setValue(IIdeUiConstants.PREF_UPDATE_SECTION_COLLAPSE, IIdeUiConstants.SECTION_COLLAPSED);
            }
            // interest
            for (AbstractDashboardPart part : parts) {
                if (!section.equals(part.getControl()) && part.getControl() instanceof Section) {
                    ((Section) part.getControl()).setExpanded(false);
                    prefStore.setValue(getExpansionPropertyId(part), IIdeUiConstants.SECTION_COLLAPSED);
                }
            }
            adjustCollapsableSections();
        }
    });
}
Also used : AbstractDashboardPart(org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) Section(org.eclipse.ui.forms.widgets.Section)

Example 23 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project webtools.sourceediting by eclipse.

the class AbstractXSLPreferencePage method createTwistie.

protected Composite createTwistie(Composite parent, String label, int cols) {
    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, cols, 1));
    excomposite.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            expandedStateChanged((ExpandableComposite) e.getSource());
        }
    });
    fExpandables.add(excomposite);
    makeScrollableCompositeAware(excomposite);
    Composite twistieCient = new Composite(excomposite, SWT.NONE);
    excomposite.setClient(twistieCient);
    GridLayout layout = new GridLayout(2, false);
    layout.marginRight = 5;
    twistieCient.setLayout(layout);
    GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
    twistieCient.setLayoutData(gd);
    return twistieCient;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) GridData(org.eclipse.swt.layout.GridData) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 24 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project hale by halestudio.

the class MismatchDetailsPage method createMismatchSection.

@SuppressWarnings("unused")
private void createMismatchSection(Composite parent) {
    // create "Mismatch" Section
    Section sectionMismatch = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    ColumnLayoutData cd = new ColumnLayoutData();
    sectionMismatch.setLayoutData(cd);
    sectionMismatch.addExpansionListener(new ExpansionAdapter() {

        public void expansionStateChanged(ExpansionEvent e) {
            overviewForm.reflow(true);
        }
    });
    sectionMismatch.setText("Mismatch");
    sectionMismatch.setDescription("General information on this mismatch.");
    Composite sectionMismatchClient = toolkit.createComposite(sectionMismatch);
    sectionMismatchClient.setLayout(new GridLayout(2, false));
    Label labelType = toolkit.createLabel(sectionMismatchClient, "Type:");
    this.textType = toolkit.createText(sectionMismatchClient, "");
    this.textType.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    this.textType.setEditable(false);
    Label labelProvenance = toolkit.createLabel(sectionMismatchClient, "Provenance:");
    this.textProvenance = toolkit.createText(sectionMismatchClient, "");
    this.textProvenance.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    this.textProvenance.setEditable(false);
    Label labelStatus = toolkit.createLabel(sectionMismatchClient, "Status:");
    this.textStatus = toolkit.createText(sectionMismatchClient, "");
    this.textStatus.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    Label labelComment = toolkit.createLabel(sectionMismatchClient, "Comments:");
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    labelComment.setLayoutData(gd);
    this.textComment = toolkit.createText(sectionMismatchClient, "", SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    gd = new GridData();
    gd.horizontalSpan = 2;
    gd.grabExcessVerticalSpace = true;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.heightHint = 40;
    textComment.setLayoutData(gd);
    toolkit.paintBordersFor(sectionMismatchClient);
    sectionMismatch.setClient(sectionMismatchClient);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ColumnLayoutData(org.eclipse.ui.forms.widgets.ColumnLayoutData) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Section(org.eclipse.ui.forms.widgets.Section) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Example 25 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project hale by halestudio.

the class MismatchDetailsPage method createReasonSection.

private void createReasonSection(Composite parent) {
    // create "Reason" Section
    Section sectionReason = toolkit.createSection(parent, Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
    ColumnLayoutData cd = new ColumnLayoutData();
    sectionReason.setLayoutData(cd);
    sectionReason.addExpansionListener(new ExpansionAdapter() {

        public void expansionStateChanged(ExpansionEvent e) {
            overviewForm.reflow(true);
        }
    });
    sectionReason.setText("Reason");
    sectionReason.setDescription("Why this mismatch occurs.");
    Composite sectionReasonClient = toolkit.createComposite(sectionReason);
    ColumnLayout reasonColumnLayout = new ColumnLayout();
    reasonColumnLayout.maxNumColumns = 1;
    sectionReasonClient.setLayout(reasonColumnLayout);
    Tree treeReason = toolkit.createTree(sectionReasonClient, SWT.NULL);
    treeReason.setLayout(new ColumnLayout());
    ColumnLayoutData treeLayoutData = new ColumnLayoutData(50, 123);
    treeReason.setLayoutData(treeLayoutData);
    toolkit.paintBordersFor(sectionReasonClient);
    sectionReason.setClient(sectionReasonClient);
    this.reasonTreeViewer = new TreeViewer(treeReason);
    this.reasonTreeViewer.setContentProvider(new ReasonContentProvider());
    this.reasonTreeViewer.setLabelProvider(new ReasonLabelProvider());
}
Also used : Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ColumnLayout(org.eclipse.ui.forms.widgets.ColumnLayout) ColumnLayoutData(org.eclipse.ui.forms.widgets.ColumnLayoutData) Tree(org.eclipse.swt.widgets.Tree) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) Section(org.eclipse.ui.forms.widgets.Section) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent)

Aggregations

ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)53 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)53 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)43 Composite (org.eclipse.swt.widgets.Composite)42 GridData (org.eclipse.swt.layout.GridData)40 GridLayout (org.eclipse.swt.layout.GridLayout)33 Section (org.eclipse.ui.forms.widgets.Section)28 TableViewer (org.eclipse.jface.viewers.TableViewer)11 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 ICellModifier (org.eclipse.jface.viewers.ICellModifier)7 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)7 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)7 TableColumn (org.eclipse.swt.widgets.TableColumn)7 TableItem (org.eclipse.swt.widgets.TableItem)7 ArrayList (java.util.ArrayList)6 ParseTree (org.antlr.v4.runtime.tree.ParseTree)6 Point (org.eclipse.swt.graphics.Point)6 AddedParseTree (org.eclipse.titan.common.parsers.AddedParseTree)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)5