Search in sources :

Example 26 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent 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 27 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent 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 28 with ExpansionEvent

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

the class MismatchDetailsPage method createConsequenceSection.

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

        public void expansionStateChanged(ExpansionEvent e) {
            overviewForm.reflow(true);
        }
    });
    sectionConsequence.setText("Consequence(s)");
    sectionConsequence.setDescription("What impacts this mismatch has.");
    Composite sectionConsequenceClient = toolkit.createComposite(sectionConsequence);
    ColumnLayout consequenceColumnLayout = new ColumnLayout();
    consequenceColumnLayout.maxNumColumns = 1;
    sectionConsequenceClient.setLayout(consequenceColumnLayout);
    Tree treeConsequence = toolkit.createTree(sectionConsequenceClient, SWT.NULL);
    treeConsequence.setLayout(new ColumnLayout());
    ColumnLayoutData treeLayoutData = new ColumnLayoutData(50, 123);
    treeConsequence.setLayoutData(treeLayoutData);
    toolkit.paintBordersFor(sectionConsequenceClient);
    sectionConsequence.setClient(sectionConsequenceClient);
    this.consequenceTreeViewer = new TreeViewer(treeConsequence);
    this.consequenceTreeViewer.setContentProvider(new ConsequenceContentProvider());
    this.consequenceTreeViewer.setLabelProvider(new ConsequenceLabelProvider());
}
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)

Example 29 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project linuxtools by eclipse.

the class OSIOWorkitemLinkAttributeEditor method createControl.

@Override
public void createControl(Composite parent, FormToolkit toolkit) {
    initialize();
    selectionProvider = new SelectionProviderAdapter();
    actionGroup = new CommentActionGroup();
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            // get comment and add reply action as first item in the menu
            ISelection selection = selectionProvider.getSelection();
            if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
                ReplyToCommentAction replyAction = new ReplyToCommentAction(currentViewer);
                manager.add(replyAction);
            }
            actionGroup.setContext(new ActionContext(selectionProvider.getSelection()));
            actionGroup.fillContextMenu(manager);
            if (currentViewer != null && currentViewer.getEditor() instanceof RichTextAttributeEditor) {
                RichTextAttributeEditor editor = (RichTextAttributeEditor) currentViewer.getEditor();
                if (editor.getViewSourceAction().isEnabled()) {
                    // $NON-NLS-1$
                    manager.add(new Separator("planning"));
                    manager.add(editor.getViewSourceAction());
                }
            }
        }
    });
    getTaskEditorPage().getEditorSite().registerContextMenu(ID_POPUP_MENU, menuManager, selectionProvider, false);
    commentMenu = menuManager.createContextMenu(parent);
    section = createSection(parent, toolkit, hasIncoming);
    // $NON-NLS-1$ //$NON-NLS-2$
    section.setText(section.getText() + " (" + commentAttributes.size() + ")");
    if (commentAttributes.isEmpty()) {
        section.setEnabled(false);
    } else {
        if (hasIncoming) {
            expandSection(toolkit, section);
        } else {
            section.addExpansionListener(new ExpansionAdapter() {

                @Override
                public void expansionStateChanged(ExpansionEvent event) {
                    if (section.getClient() == null) {
                        try {
                            expandAllInProgress = true;
                            getTaskEditorPage().setReflow(false);
                            expandSection(toolkit, section);
                        } finally {
                            expandAllInProgress = false;
                            getTaskEditorPage().setReflow(true);
                        }
                        reflow();
                    }
                }
            });
        }
    }
    setSection(toolkit, section);
}
Also used : RichTextAttributeEditor(org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor) SelectionProviderAdapter(org.eclipse.mylyn.commons.ui.SelectionProviderAdapter) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) CommentActionGroup(org.eclipse.mylyn.internal.tasks.ui.actions.CommentActionGroup) ActionContext(org.eclipse.ui.actions.ActionContext) IMenuListener(org.eclipse.jface.action.IMenuListener) AbstractReplyToCommentAction(org.eclipse.mylyn.internal.tasks.ui.editors.AbstractReplyToCommentAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) ISelection(org.eclipse.jface.viewers.ISelection) IMenuManager(org.eclipse.jface.action.IMenuManager) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) Separator(org.eclipse.jface.action.Separator)

Example 30 with ExpansionEvent

use of org.eclipse.ui.forms.events.ExpansionEvent in project yamcs-studio by yamcs.

the class AddToStackWizardPage2 method createControl.

@Override
public void createControl(Composite parent) {
    controlComposite = new Composite(parent, SWT.NONE);
    setControl(controlComposite);
    controlComposite.setLayout(new GridLayout());
    // command namespace selection
    Composite namespaceComposite = new Composite(controlComposite, SWT.NONE);
    namespaceComposite.setLayout(new GridLayout(2, false));
    Label chooseNamespace = new Label(namespaceComposite, SWT.NONE);
    chooseNamespace.setText("Choose Command Namespace: ");
    namespaceCombo = new Combo(namespaceComposite, SWT.READ_ONLY);
    namespaceCombo.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            command.setSelectedAliase(aliases.get(namespaceCombo.getSelectionIndex()));
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    // expandable command options
    ExpandableComposite ec = new ExpandableComposite(controlComposite, ExpandableComposite.TREE_NODE | ExpandableComposite.CLIENT_INDENT);
    ec.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ec.setLayout(new GridLayout(1, false));
    ec.setExpanded(false);
    ec.setText("Command Options");
    Composite optionsComposite = new Composite(ec, SWT.NONE);
    optionsComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    optionsComposite.setLayout(new GridLayout(2, false));
    Label l1 = new Label(optionsComposite, SWT.NONE);
    l1.setText("Comment");
    GridData gridData = new GridData(SWT.NONE, SWT.TOP, false, false);
    l1.setLayoutData(gridData);
    Text comment = new Text(optionsComposite, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
    comment.setText(command.getComment() != null ? command.getComment() : "");
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gridData.heightHint = 2 * comment.getLineHeight();
    comment.setLayoutData(gridData);
    ec.setClient(optionsComposite);
    ec.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            parent.layout(true);
            controlComposite.layout(true);
        }
    });
    comment.addModifyListener(evt -> {
        if (comment.getText().trim().isEmpty()) {
            command.setComment(null);
        } else {
            command.setComment(comment.getText());
        }
    });
    // argument table
    atb = new ArgumentTableBuilder(command);
    atb.createArgumentTable(controlComposite);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) Text(org.eclipse.swt.widgets.Text) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)58 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)53 GridData (org.eclipse.swt.layout.GridData)46 Composite (org.eclipse.swt.widgets.Composite)46 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)46 GridLayout (org.eclipse.swt.layout.GridLayout)38 Section (org.eclipse.ui.forms.widgets.Section)30 SelectionEvent (org.eclipse.swt.events.SelectionEvent)12 TableViewer (org.eclipse.jface.viewers.TableViewer)11 ArrayList (java.util.ArrayList)7 ICellModifier (org.eclipse.jface.viewers.ICellModifier)7 TextCellEditor (org.eclipse.jface.viewers.TextCellEditor)7 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)7 SelectionListener (org.eclipse.swt.events.SelectionListener)7 Point (org.eclipse.swt.graphics.Point)7 Label (org.eclipse.swt.widgets.Label)7 TableColumn (org.eclipse.swt.widgets.TableColumn)7 TableItem (org.eclipse.swt.widgets.TableItem)7 ParseTree (org.antlr.v4.runtime.tree.ParseTree)6 AddedParseTree (org.eclipse.titan.common.parsers.AddedParseTree)6