Example usage for org.eclipse.jface.databinding.viewers ViewerProperties singleSelection

List of usage examples for org.eclipse.jface.databinding.viewers ViewerProperties singleSelection

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.viewers ViewerProperties singleSelection.

Prototype

public static IViewerValueProperty singleSelection() 

Source Link

Document

Returns a value property for observing the single selection of a ISelectionProvider .

Usage

From source file:org.eclipse.papyrus.widgets.editors.ReferenceCombo.java

License:Open Source License

/**
 * Sets the content provider for this combo. The Content provider should
 * specify the objects that can be referred by this property
 * //w w  w.  j  av  a2 s .c  om
 * @param provider
 */
public void setContentProvider(IStaticContentProvider provider) {
    viewer.setContentProvider(new EncapsulatedContentProvider(provider));
    viewer.setInput(""); //$NON-NLS-1$
    setWidgetObservable(ViewerProperties.singleSelection().observe(viewer), true);
}

From source file:org.eclipse.papyrus.xwt.databinding.JFaceXWTDataBinding.java

License:Open Source License

protected static IObservable observePropertyValue(Object object, String propertyName,
        UpdateSourceTrigger updateSourceTrigger) {
    if (object instanceof Viewer) {
        if ("input".equals(propertyName)) {
            Viewer viewer = (Viewer) object;
            SimpleValueProperty property = (SimpleValueProperty) ViewerProperties.input();
            IObservableValue observableValue = new SimplePropertyObservableValue(XWT.getRealm(), viewer,
                    property);/*from w  w w  . jav  a 2 s  .  c o m*/
            return new TypedViewerObservableValueDecorator(observableValue, viewer);
        } else if ("singleSelection".equals(propertyName)) {
            Viewer viewer = (Viewer) object;
            SimpleValueProperty property = (SimpleValueProperty) ViewerProperties.singleSelection();
            IObservableValue observableValue = new SimplePropertyObservableValue(XWT.getRealm(), viewer,
                    property);
            return new TypedViewerObservableValueDecorator(observableValue, viewer);
        }
        return observePropertyValue((Viewer) object, propertyName, updateSourceTrigger);
    } else if (object instanceof MenuItem) {
        //
        // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=280157
        // testcase:
        // org.eclipse.papyrus.xwt.tests.databinding.bindcontrol.BindMenuItem
        //
        if (ENABLED.equalsIgnoreCase(propertyName)) {
            return new MenuItemEnabledObservableValue((MenuItem) object);
        } else if (SELECTION.equalsIgnoreCase(propertyName)) {
            return new MenuItemSelectionObservableValue((MenuItem) object);
        }
    } else if (object instanceof Control) {
        return observePropertyValue((Control) object, propertyName, updateSourceTrigger);
    }
    return null;
}

From source file:org.eclipse.pde.ds.ui.internal.editor.detailpart.services.ReferenceDetailsPart.java

License:Open Source License

protected void bind(DataBindingContext bindingContext) {
    // Name/*from  w  ww  . j  a  va 2 s.c o  m*/
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(referenceComposite.getTextName()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Name())
                    .observeDetail(getCurrentSelection()),
            null, null);

    // Interface
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(referenceComposite.getTextInterface()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Interface())
                    .observeDetail(getCurrentSelection()),
            null, null);

    // Cardinality
    bindingContext.bindValue(
            ViewerProperties.singleSelection().observe(referenceComposite.getComboCardinality()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Cardinality())
                    .observeDetail(getCurrentSelection()),
            null, null);

    // Policy
    bindingContext.bindValue(ViewerProperties.singleSelection().observe(referenceComposite.getComboPolicy()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Policy())
                    .observeDetail(getCurrentSelection()),
            null, null);

    // Target
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(referenceComposite.getTextTarget()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Target())
                    .observeDetail(getCurrentSelection()),
            null, null);

    // Bind
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(referenceComposite.getTextBind()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Bind())
                    .observeDetail(getCurrentSelection()),
            null, null);

    // Unbind
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(referenceComposite.getTextUnbind()),
            EMFEditProperties.value(getEditingDomain(), ScrPackage.eINSTANCE.getReference_Unbind())
                    .observeDetail(getCurrentSelection()),
            null, null);

}

From source file:org.eclipse.pde.ds.ui.internal.editor.OverviewPage.java

License:Open Source License

public void bind(DataBindingContext bindingContext) {
    final EditingDomain editingDomain = ((DSEditor) getEditor()).getEditingDomain();

    /**/*  w  w  w  .j  a v  a2s. c  o m*/
     * Bind Component composite
     */
    // component name
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(_componentComposite.getTextName()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Name())
                    .observeDetail(getObservedValue()),
            null, null);
    // component impl
    bindingContext.bindValue(
            WidgetProperties.text(SWT.FocusOut).observe(_componentComposite.getTextImplementation()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Implementation())
                    .value(ScrPackage.eINSTANCE.getImplementation_Class()).observeDetail(getObservedValue()),
            new EMFUpdateValueStrategy() {
                @Override
                public Object convert(Object value) {
                    if (((String) value).trim().equals(""))
                        return null;
                    return super.convert(value);
                }
            }, null);

    // component activate
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(_componentComposite.getTextActivate()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Activate())
                    .observeDetail(getObservedValue()),
            null, null);

    // component deactivate
    bindingContext.bindValue(
            WidgetProperties.text(SWT.FocusOut).observe(_componentComposite.getTextDeactivate()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Deactivate())
                    .observeDetail(getObservedValue()),
            null, null);

    // component modified
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(_componentComposite.getTextModified()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Modified())
                    .observeDetail(getObservedValue()),
            null, null);

    /**
     * Bind Options composite
     */
    // component factory ID
    bindingContext.bindValue(WidgetProperties.text(SWT.FocusOut).observe(_optionsComposite.getTextFactory()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Factory())
                    .observeDetail(getObservedValue()),
            null, null);
    // component configuration policy
    bindingContext.bindValue(
            ViewerProperties.singleSelection().observe(_optionsComposite.getComboViewerConfigurationPolicy()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_ConfigurationPolicy())
                    .observeDetail(getObservedValue()),
            null, null);
    // component enablement
    bindingContext.bindValue(WidgetProperties.selection().observe(_optionsComposite.getButtonEnabled()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Enabled())
                    .observeDetail(getObservedValue()),
            null, null);
    // component immediacy
    bindingContext.bindValue(WidgetProperties.selection().observe(_optionsComposite.getButtonImmediate()),
            EMFEditProperties.value(editingDomain, ScrPackage.eINSTANCE.getComponent_Immediate())
                    .observeDetail(getObservedValue()),
            null, null);

    // perform bindings to get a message manager up to date
    // FIXME this is just not good to do such a thing :)
    bindingContext.updateModels();
    editingDomain.getCommandStack().flush();
}

From source file:org.eclipse.recommenders.internal.snipmatch.rcp.editors.SnippetMetadataPage.java

License:Open Source License

private DataBindingContext createDataBindingContext() {
    DataBindingContext context = new DataBindingContext();

    // Name//from  ww  w.  ja  va 2  s.  c  o m
    IObservableValue wpTxtNameText = text(SWT.Modify).observe(txtName);
    IObservableValue ppName = value(Snippet.class, "name", String.class).observe(snippet); //$NON-NLS-1$
    context.bindValue(wpTxtNameText, ppName);
    ppName.addChangeListener(new ContentsPartDirtyListener());

    // Description
    IObservableValue wpTxtDescriptionText = text(SWT.Modify).observe(txtDescription);
    IObservableValue ppDescription = value(Snippet.class, "description", String.class).observe(snippet); //$NON-NLS-1$
    context.bindValue(wpTxtDescriptionText, ppDescription);
    ppDescription.addChangeListener(new ContentsPartDirtyListener());

    // Location
    IObservableValue wpTxtLocation = ViewerProperties.singleSelection().observe(comboLocation);
    IObservableValue ppLocation = value(Snippet.class, "location", Location.class).observe(snippet); //$NON-NLS-1$

    context.bindValue(wpTxtLocation, ppLocation);
    ppLocation.addChangeListener(new ContentsPartDirtyListener());

    // Filenames
    ppFilenameRestrictions = BeanProperties.list(Snippet.class, "filenameRestrictions", String.class) //$NON-NLS-1$
            .observe(snippet);
    ppFilenameRestrictions.addChangeListener(new ContentsPartDirtyListener());
    ViewerSupport.bind(listViewerFilenameRestrictions, ppFilenameRestrictions,
            new FilenameRestrictionLabelProperty());

    // Extra search terms
    ppExtraSearchTerms = BeanProperties.list(Snippet.class, "extraSearchTerms", String.class).observe(snippet); //$NON-NLS-1$
    ViewerSupport.bind(listViewerExtraSearchTerms, ppExtraSearchTerms, new SelfValueProperty(String.class));
    ppExtraSearchTerms.addChangeListener(new ContentsPartDirtyListener());

    // Tags
    ppTags = BeanProperties.list(Snippet.class, "tags", String.class).observe(snippet); //$NON-NLS-1$
    ViewerSupport.bind(listViewerTags, ppTags, new SelfValueProperty(String.class));
    ppTags.addChangeListener(new ContentsPartDirtyListener());

    // Dependencies
    ppDependencies = BeanProperties.set(Snippet.class, "neededDependencies", ProjectCoordinate.class) //$NON-NLS-1$
            .observe(snippet);
    ViewerSupport.bind(listViewerDependencies, ppDependencies, new SimpleValueProperty() {

        @Override
        public Object getValueType() {
            return ProjectCoordinate.class;
        }

        @Override
        protected Object doGetValue(Object source) {
            if (source != null) {
                ProjectCoordinate pc = cast(source);
                return getStringForDependency(pc);
            }
            return ""; //$NON-NLS-1$
        }

        @Override
        protected void doSetValue(Object source, Object value) {
        }

        @Override
        public INativePropertyListener adaptListener(ISimplePropertyListener listener) {
            return null;
        }

    });
    ppDependencies.addChangeListener(new ContentsPartDirtyListener());

    // uuid
    UpdateValueStrategy stringToUuidStrategy = new UpdateValueStrategy();
    StringToUuidConverter stringToUuidConverter = new StringToUuidConverter();
    stringToUuidStrategy.setConverter(stringToUuidConverter);

    IObservableValue wpUuidText = text(SWT.Modify).observe(txtUuid);
    IObservableValue ppUuid = value(Snippet.class, "uuid", UUID.class).observe(snippet); //$NON-NLS-1$
    context.bindValue(wpUuidText, ppUuid, stringToUuidStrategy, null);
    ppUuid.addChangeListener(new ContentsPartDirtyListener());

    // enable widgets
    UpdateValueStrategy strategy = new UpdateValueStrategy();
    strategy.setConverter(new ObjectToBooleanConverter());

    final IObservableValue vpFilenamesSelection = singleSelection().observe(listViewerFilenameRestrictions);
    IObservableValue wpBtnRemoveFilenamesEnable = enabled().observe(btnRemoveFilenameRestriction);

    IObservableValue vpLocationSelection = ViewersObservables.observeSingleSelection(comboLocation);
    IObservableValue wpListViewerFilenamesEnabled = enabled()
            .observe(listViewerFilenameRestrictions.getControl());
    final IObservableValue wpBtnAddFilenamesEnabled = enabled().observe(btnAddFilenameRestriction);

    UpdateValueStrategy locationEnablementStrategy = new UpdateValueStrategy();
    EnumToBooleanConverter<Location> locationToBooleanConverter = new EnumToBooleanConverter<Location>(
            Location.FILE);
    locationEnablementStrategy.setConverter(locationToBooleanConverter);

    context.bindValue(vpLocationSelection, wpListViewerFilenamesEnabled, locationEnablementStrategy, null);
    context.bindValue(vpLocationSelection, wpBtnAddFilenamesEnabled, locationEnablementStrategy, null);

    ComputedValue computedRemoveButtonEnablement = new ComputedValue() {

        @Override
        protected Object calculate() {
            boolean addButtonEnabled = (boolean) wpBtnAddFilenamesEnabled.getValue();
            return vpFilenamesSelection.getValue() != null && addButtonEnabled;
        }
    };
    context.bindValue(wpBtnRemoveFilenamesEnable, computedRemoveButtonEnablement);

    IObservableValue vpExtraSearchTermsSelection = singleSelection().observe(listViewerExtraSearchTerms);
    IObservableValue wpBtnRemoveExtraSearchTermEnable = enabled().observe(btnRemoveExtraSearchTerm);
    context.bindValue(vpExtraSearchTermsSelection, wpBtnRemoveExtraSearchTermEnable, strategy, null);

    IObservableValue vpTagSelection = singleSelection().observe(listViewerTags);
    IObservableValue wpBtnRemoveTagsEnable = enabled().observe(btnRemoveTag);
    context.bindValue(vpTagSelection, wpBtnRemoveTagsEnable, strategy, null);

    IObservableValue vpDependencySelection = singleSelection().observe(listViewerDependencies);
    IObservableValue wpBtnRemoveDependenciesEnable = enabled().observe(btnRemoveDependency);
    context.bindValue(vpDependencySelection, wpBtnRemoveDependenciesEnable, strategy, null);

    context.updateModels();
    return context;
}

From source file:org.eclipse.reqcycle.ocl.ui.SettingPage.java

License:Open Source License

protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    ////w  w  w.  ja  va 2s. c  om
    IObservableValue observeTextFileURITextObserveWidget = WidgetProperties.text(SWT.Modify).observe(tFile);
    IObservableValue uriBeanObserveValue = PojoProperties.value("uri").observe(bean);
    bindingContext.bindValue(observeTextFileURITextObserveWidget, uriBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionCvDataModel = ViewerProperties.singleSelection()
            .observe(cvDataModel);
    IObservableValue dataPackageBeanObserveValue = PojoProperties.value("dataPackage").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvDataModel, dataPackageBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionCvScope = ViewerProperties.singleSelection().observe(cvScope);
    IObservableValue scopeBeanObserveValue = PojoProperties.value("scope").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvScope, scopeBeanObserveValue, null, null);
    //
    return bindingContext;
}

From source file:org.eclipse.reqcycle.repository.connector.rmf.ui.RMFSettingPage.java

License:Open Source License

protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    ////from   w w w. j av  a  2 s.  com
    IObservableValue observeTextFileURITextObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(fileURIText);
    IObservableValue uriBeanObserveValue = PojoProperties.value("uri").observe(bean);
    bindingContext.bindValue(observeTextFileURITextObserveWidget, uriBeanObserveValue, null, null);
    //
    IObservableValue observeSelectionBtnCopyImportObserveWidget = WidgetProperties.selection()
            .observe(btnCopyImport);
    IObservableValue isCopyBeanObserveValue = PojoProperties.value("isCopy").observe(bean);
    bindingContext.bindValue(observeSelectionBtnCopyImportObserveWidget, isCopyBeanObserveValue, null, null);
    //
    IObservableValue observeSelectionBtnSkipMappingObserveWidget = WidgetProperties.selection()
            .observe(btnSkipMapping);
    IObservableValue skipMappingBeanObserveValue = PojoProperties.value("skipMapping").observe(bean);
    bindingContext.bindValue(observeSelectionBtnSkipMappingObserveWidget, skipMappingBeanObserveValue, null,
            null);
    //
    IObservableValue observeSingleSelectionCvDataModel = ViewerProperties.singleSelection()
            .observe(cvDataModel);
    IObservableValue dataPackageBeanObserveValue = PojoProperties.value("dataPackage").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvDataModel, dataPackageBeanObserveValue, null, null);
    //
    IObservableValue observeSingleSelectionCvScope = ViewerProperties.singleSelection().observe(cvScope);
    IObservableValue scopeBeanObserveValue = PojoProperties.value("scope").observe(bean);
    bindingContext.bindValue(observeSingleSelectionCvScope, scopeBeanObserveValue, null, null);
    //
    IObservableValue observeTextTxtFileObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtFile);
    IObservableValue modelPathBeanObserveValue = PojoProperties.value("destinationPath").observe(bean);
    bindingContext.bindValue(observeTextTxtFileObserveWidget, modelPathBeanObserveValue, null, null);
    //
    return bindingContext;
}

From source file:org.eclipse.reqcycle.repository.data.ui.dialog.AddAttributeDialog.java

License:Open Source License

@Override
protected void doInitDataBindings(DataBindingContext bindingContext) {
    IObservableValue observeSingleSelectionAttrCV = ViewerProperties.singleSelection().observe(cvAttribute);
    IObservableValue typeBeanObserveValue = PojoProperties.value("type").observe(bean);
    bindingContext.bindValue(observeSingleSelectionAttrCV, typeBeanObserveValue, null, null);
}

From source file:org.eclipse.thym.ui.config.internal.IconsPage.java

License:Open Source License

protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    ////  w w w .j  av a  2  s .com
    ObservableListContentProvider listContentProvider = new ObservableListContentProvider();
    IObservableMap observeMap = BeansObservables.observeMap(listContentProvider.getKnownElements(), Icon.class,
            "src");
    iconsTableViewer.setLabelProvider(new ObservableMapLabelProvider(observeMap));
    iconsTableViewer.setContentProvider(listContentProvider);
    //
    IObservableList iconsGetWidgetObserveList = BeanProperties.list("icons").observe(getWidget());
    iconsTableViewer.setInput(iconsGetWidgetObserveList);
    //
    ObservableListContentProvider listContentProvider_1 = new ObservableListContentProvider();
    IObservableMap observeMap_1 = BeansObservables.observeMap(listContentProvider_1.getKnownElements(),
            Splash.class, "src");
    splashTableViewer.setLabelProvider(new ObservableMapLabelProvider(observeMap_1));
    splashTableViewer.setContentProvider(listContentProvider_1);
    //
    IObservableList splashesGetWidgetObserveList = BeanProperties.list("splashes").observe(getWidget());
    splashTableViewer.setInput(splashesGetWidgetObserveList);
    //
    IObservableValue observeSingleSelectionIconsTableViewer = ViewerProperties.singleSelection()
            .observe(iconsTableViewer);
    IObservableValue iconsTableViewerWidthObserveDetailValue = BeanProperties
            .value(Icon.class, "width", int.class).observeDetail(observeSingleSelectionIconsTableViewer);
    IObservableValue observeTextTxtWidthObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtWidth);
    bindingContext.bindValue(iconsTableViewerWidthObserveDetailValue, observeTextTxtWidthObserveWidget, null,
            null);
    //
    IObservableValue observeSingleSelectionIconsTableViewer_1 = ViewerProperties.singleSelection()
            .observe(iconsTableViewer);
    IObservableValue iconsTableViewerHeightObserveDetailValue = BeanProperties
            .value(Icon.class, "height", int.class).observeDetail(observeSingleSelectionIconsTableViewer_1);
    IObservableValue observeTextTxtHeightObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtHeight);
    bindingContext.bindValue(iconsTableViewerHeightObserveDetailValue, observeTextTxtHeightObserveWidget, null,
            null);
    //
    IObservableValue observeSingleSelectionIconsTableViewer_2 = ViewerProperties.singleSelection()
            .observe(iconsTableViewer);
    IObservableValue iconsTableViewerPlatformObserveDetailValue = BeanProperties
            .value(Icon.class, "platform", String.class)
            .observeDetail(observeSingleSelectionIconsTableViewer_2);
    IObservableValue observeTextTxtPlatformObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtPlatform);
    bindingContext.bindValue(iconsTableViewerPlatformObserveDetailValue, observeTextTxtPlatformObserveWidget,
            null, null);
    //
    IObservableValue observeSingleSelectionIconsTableViewer_3 = ViewerProperties.singleSelection()
            .observe(iconsTableViewer);
    IObservableValue iconsTableViewerDensityObserveDetailValue = BeanProperties
            .value(Icon.class, "density", String.class).observeDetail(observeSingleSelectionIconsTableViewer_3);
    IObservableValue observeTextTxtDensityObserveWidget = WidgetProperties.text(SWT.Modify).observe(txtDensity);
    bindingContext.bindValue(iconsTableViewerDensityObserveDetailValue, observeTextTxtDensityObserveWidget,
            null, null);
    //
    IObservableValue observeSingleSelectionSplashTableViewer = ViewerProperties.singleSelection()
            .observe(splashTableViewer);
    IObservableValue splashTableViewerWidthObserveDetailValue = BeanProperties
            .value(Splash.class, "width", int.class).observeDetail(observeSingleSelectionSplashTableViewer);
    IObservableValue observeTextTxtSplshWidthObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtSplshWidth);
    bindingContext.bindValue(splashTableViewerWidthObserveDetailValue, observeTextTxtSplshWidthObserveWidget,
            null, null);
    //
    IObservableValue observeSingleSelectionSplashTableViewer_1 = ViewerProperties.singleSelection()
            .observe(splashTableViewer);
    IObservableValue splashTableViewerHeightObserveDetailValue = BeanProperties
            .value(Splash.class, "height", int.class).observeDetail(observeSingleSelectionSplashTableViewer_1);
    IObservableValue observeTextTxtSplshHeightObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtSplshHeight);
    bindingContext.bindValue(splashTableViewerHeightObserveDetailValue, observeTextTxtSplshHeightObserveWidget,
            null, null);
    //
    IObservableValue observeSingleSelectionSplashTableViewer_2 = ViewerProperties.singleSelection()
            .observe(splashTableViewer);
    IObservableValue splashTableViewerPlatformObserveDetailValue = BeanProperties
            .value(Splash.class, "platform", String.class)
            .observeDetail(observeSingleSelectionSplashTableViewer_2);
    IObservableValue observeTextTxtSplshPlatformObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtSplshPlatform);
    bindingContext.bindValue(splashTableViewerPlatformObserveDetailValue,
            observeTextTxtSplshPlatformObserveWidget, null, null);
    //
    IObservableValue observeSingleSelectionSplashTableViewer_3 = ViewerProperties.singleSelection()
            .observe(splashTableViewer);
    IObservableValue splashTableViewerDensityObserveDetailValue = BeanProperties
            .value(Splash.class, "density", String.class)
            .observeDetail(observeSingleSelectionSplashTableViewer_3);
    IObservableValue observeTextTxtSplshDensityObserveWidget = WidgetProperties.text(SWT.Modify)
            .observe(txtSplshDensity);
    bindingContext.bindValue(splashTableViewerDensityObserveDetailValue,
            observeTextTxtSplshDensityObserveWidget, null, null);
    //
    return bindingContext;
}

From source file:org.eclipse.xwt.databinding.JFaceXWTDataBinding.java

License:Open Source License

protected static IObservable observePropertyValue(Object object, String propertyName,
        UpdateSourceTrigger updateSourceTrigger) {
    if (object instanceof Viewer) {
        if ("input".equals(propertyName)) {
            Viewer viewer = (Viewer) object;
            SimpleValueProperty property = (SimpleValueProperty) ViewerProperties.input();
            IObservableValue observableValue = new SimplePropertyObservableValue(XWT.getRealm(), viewer,
                    property);/*from  w  w  w.  j a v  a 2  s  . c  om*/
            return new TypedViewerObservableValueDecorator(observableValue, viewer);
        } else if ("singleSelection".equals(propertyName)) {
            Viewer viewer = (Viewer) object;
            SimpleValueProperty property = (SimpleValueProperty) ViewerProperties.singleSelection();
            IObservableValue observableValue = new SimplePropertyObservableValue(XWT.getRealm(), viewer,
                    property);
            return new TypedViewerObservableValueDecorator(observableValue, viewer);
        }
        return observePropertyValue((Viewer) object, propertyName, updateSourceTrigger);
    } else if (object instanceof MenuItem) {
        //
        // TODO https://bugs.eclipse.org/bugs/show_bug.cgi?id=280157
        // testcase:
        // org.eclipse.xwt.tests.databinding.bindcontrol.BindMenuItem
        //
        if (ENABLED.equalsIgnoreCase(propertyName)) {
            return new MenuItemEnabledObservableValue((MenuItem) object);
        } else if (SELECTION.equalsIgnoreCase(propertyName)) {
            return new MenuItemSelectionObservableValue((MenuItem) object);
        }
    } else if (object instanceof Control) {
        return observePropertyValue((Control) object, propertyName, updateSourceTrigger);
    }
    return null;
}