Search in sources :

Example 51 with ExpansionAdapter

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

the class HibernateColumnComposite method initializeLayout.

@Override
protected void initializeLayout(Composite container) {
    // // Column group pane
    // container = addTitledGroup(
    // container,
    // JptJpaUiDetailsMessages.ColumnComposite_columnSection
    // );
    // 
    // // Column widgets
    // addLabeledComposite(
    // container,
    // JptJpaUiDetailsMessages.ColumnComposite_name,
    // addColumnCombo(container),
    // JpaHelpContextIds.MAPPING_COLUMN
    // );
    // 
    // // Table widgets
    // addLabeledComposite(
    // container,
    // JptJpaUiDetailsMessages.ColumnComposite_table,
    // addTableCombo(container),
    // JpaHelpContextIds.MAPPING_COLUMN_TABLE
    // );
    // 
    // // Details sub-pane
    // container = addCollapsibleSubSection(
    // container,
    // JptJpaUiDetailsMessages.ColumnComposite_details,
    // new SimplePropertyValueModel<Boolean>(Boolean.FALSE)
    // );
    // 
    // new DetailsComposite(this, getSubjectHolder(), addSubPane(container, 0, 16));
    // Column widgets
    this.addLabel(container, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_NAME);
    this.addColumnCombo(container);
    // Table widgets
    this.addLabel(container, JptJpaUiDetailsMessages.COLUMN_COMPOSITE_TABLE);
    this.addTableCombo(container);
    // Details sub-pane
    final Section detailsSection = this.getWidgetFactory().createSection(container, ExpandableComposite.TWISTIE);
    detailsSection.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    detailsSection.setText(JptJpaUiDetailsMessages.COLUMN_COMPOSITE_DETAILS);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    detailsSection.setLayoutData(gridData);
    detailsSection.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanging(ExpansionEvent e) {
            if (e.getState() && detailsSection.getClient() == null) {
                detailsSection.setClient(HibernateColumnComposite.this.initializeDetailsSection(detailsSection));
            }
        }
    });
}
Also used : 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 52 with ExpansionAdapter

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

the class HibernateJavaEntity2_0Composite method initializeTypeDefCollapsibleSection.

protected void initializeTypeDefCollapsibleSection(Composite container) {
    final Section section = this.getWidgetFactory().createSection(container, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE);
    section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // $NON-NLS-1$
    section.setText("Type Definitions");
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanging(ExpansionEvent e) {
            if (e.getState() && section.getClient() == null) {
                section.setClient(initializeTypeDefsSection(section, buildTypeDefContainerHolder()));
            }
        }
    });
}
Also used : 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 53 with ExpansionAdapter

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

the class BuildConfigWizardPage method doCreateControls.

@Override
protected void doCreateControls(Composite parent, DataBindingContext dbc) {
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(parent);
    GridLayoutFactory.fillDefaults().applyTo(parent);
    Group buildConfigsGroup = new Group(parent, SWT.NONE);
    buildConfigsGroup.setText("Existing Build Configs:");
    GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).applyTo(buildConfigsGroup);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(buildConfigsGroup);
    // build configs tree
    TreeViewer buildConfigsViewer = createBuildConfigsViewer(new Tree(buildConfigsGroup, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL), model);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(SWT.DEFAULT, 200).span(1, 2).applyTo(buildConfigsViewer.getControl());
    final IObservableValue selectedItem = BeanProperties.value(IBuildConfigPageModel.PROPERTY_SELECTED_ITEM).observe(model);
    Binding selectedBuildConfigBinding = ValueBindingBuilder.bind(ViewerProperties.singleSelection().observe(buildConfigsViewer)).converting(new ObservableTreeItem2ModelConverter()).to(selectedItem).converting(new Model2ObservableTreeItemConverter()).in(dbc);
    dbc.addValidationStatusProvider(new MultiValidator() {

        @Override
        protected IStatus validate() {
            if (!(selectedItem.getValue() instanceof IBuildConfig)) {
                return ValidationStatus.cancel("Please select the existing build config that you want to import");
            } else {
                return ValidationStatus.ok();
            }
        }
    });
    IObservableValue connectionObservable = BeanProperties.value(IBuildConfigPageModel.PROPERTY_CONNECTION).observe(model);
    DataBindingUtils.addDisposableValueChangeListener(onConnectionChanged(buildConfigsViewer, model), connectionObservable, buildConfigsViewer.getTree());
    ControlDecorationSupport.create(selectedBuildConfigBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater(true));
    // refresh button
    Button refreshButton = new Button(buildConfigsGroup, SWT.PUSH);
    refreshButton.setText("&Refresh");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(100, SWT.DEFAULT).applyTo(refreshButton);
    refreshButton.addSelectionListener(onRefresh(buildConfigsViewer, model));
    // filler
    Label fillerLabel = new Label(buildConfigsGroup, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(false, true).applyTo(fillerLabel);
    // details
    ExpandableComposite expandable = new ExpandableComposite(buildConfigsGroup, SWT.None);
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).hint(SWT.DEFAULT, 150).applyTo(expandable);
    expandable.setText("Build config Details");
    expandable.setExpanded(true);
    GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).applyTo(expandable);
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).hint(SWT.DEFAULT, 150).applyTo(expandable);
    Composite detailsContainer = new Composite(expandable, SWT.NONE);
    GridDataFactory.fillDefaults().span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, false).hint(SWT.DEFAULT, 150).applyTo(detailsContainer);
    IObservableValue selectedService = new WritableValue();
    ValueBindingBuilder.bind(selectedItem).to(selectedService).notUpdatingParticipant().in(dbc);
    new BuildConfigDetailViews(selectedService, detailsContainer, dbc).createControls();
    expandable.setClient(detailsContainer);
    expandable.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            buildConfigsGroup.update();
            buildConfigsGroup.layout(true);
        }
    });
    loadBuildConfigs(model);
}
Also used : Binding(org.eclipse.core.databinding.Binding) Group(org.eclipse.swt.widgets.Group) IStatus(org.eclipse.core.runtime.IStatus) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Label(org.eclipse.swt.widgets.Label) ObservableTreeItem2ModelConverter(org.jboss.tools.openshift.internal.ui.treeitem.ObservableTreeItem2ModelConverter) BuildConfigDetailViews(org.jboss.tools.openshift.internal.ui.server.BuildConfigDetailViews) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) MultiValidator(org.eclipse.core.databinding.validation.MultiValidator) WritableValue(org.eclipse.core.databinding.observable.value.WritableValue) RequiredControlDecorationUpdater(org.jboss.tools.openshift.internal.common.ui.databinding.RequiredControlDecorationUpdater) Model2ObservableTreeItemConverter(org.jboss.tools.openshift.internal.ui.wizard.importapp.BuildConfigTreeItems.Model2ObservableTreeItemConverter) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Button(org.eclipse.swt.widgets.Button) Tree(org.eclipse.swt.widgets.Tree) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) 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