Search in sources :

Example 26 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project jbosstools-openshift by jbosstools.

the class ServerSettingsWizardPage method createResourceDetails.

private void createResourceDetails(IViewerObservableValue selectedResourceTreeItem, Composite parent, DataBindingContext dbc) {
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    ExpandableComposite expandable = new ExpandableComposite(scrolledComposite, SWT.None);
    scrolledComposite.setContent(expandable);
    expandable.setText("Resource Details");
    expandable.setExpanded(true);
    expandable.setLayout(new FillLayout());
    Composite detailsContainer = new Composite(expandable, SWT.NONE);
    expandable.setClient(detailsContainer);
    expandable.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            getControl().update();
            ((Composite) getControl()).layout(true);
        }
    });
    IObservableValue<IResource> selectedResource = new WritableValue<>();
    ValueBindingBuilder.bind(selectedResourceTreeItem).converting(new ObservableTreeItem2ModelConverter()).to(selectedResource).notUpdatingParticipant().in(dbc);
    new ResourceDetailViews(selectedResource, detailsContainer, dbc).createControls();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ObservableTreeItem2ModelConverter(org.jboss.tools.openshift.internal.ui.treeitem.ObservableTreeItem2ModelConverter) FillLayout(org.eclipse.swt.layout.FillLayout) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) WritableValue(org.eclipse.core.databinding.observable.value.WritableValue) IResource(com.openshift.restclient.model.IResource)

Example 27 with ExpansionAdapter

use of org.eclipse.ui.forms.events.ExpansionAdapter in project jbosstools-openshift by jbosstools.

the class ResourceSummaryDialog method createResourceDetails.

private void createResourceDetails(StructuredViewer viewer, Composite parent) {
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    ExpandableComposite expandable = new ExpandableComposite(scrolledComposite, SWT.None);
    scrolledComposite.setContent(expandable);
    expandable.setText("Resource Details");
    expandable.setExpanded(true);
    expandable.setLayout(new FillLayout());
    Composite detailsContainer = new Composite(expandable, SWT.NONE);
    expandable.setClient(detailsContainer);
    expandable.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            parent.update();
            parent.layout(true);
        }
    });
    DataBindingContext dbc = new DataBindingContext();
    IViewerObservableValue<Object> selectedResource = ViewerProperties.singlePostSelection().observe(viewer);
    new ResourceDetailViews(selectedResource, detailsContainer, dbc).createControls();
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) FillLayout(org.eclipse.swt.layout.FillLayout) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) DataBindingContext(org.eclipse.core.databinding.DataBindingContext) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) ResourceDetailViews(org.jboss.tools.openshift.internal.ui.server.ResourceDetailViews)

Example 28 with ExpansionAdapter

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

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

the class AbstractValidationSettingsPage method createStyleSectionWithContentComposite.

protected Composite createStyleSectionWithContentComposite(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);
    Composite inner = new Composite(excomposite, SWT.NONE);
    inner.setFont(excomposite.getFont());
    inner.setLayout(new GridLayout(nColumns, false));
    excomposite.setClient(inner);
    return inner;
}
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 30 with ExpansionAdapter

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

the class AbstractValidationSettingsPage method createStyleSection.

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;
}
Also used : 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)

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