Example usage for org.eclipse.jface.databinding.swt SWTObservables getRealm

List of usage examples for org.eclipse.jface.databinding.swt SWTObservables getRealm

Introduction

In this page you can find the example usage for org.eclipse.jface.databinding.swt SWTObservables getRealm.

Prototype

@Deprecated
public static Realm getRealm(final Display display) 

Source Link

Document

Returns the realm representing the UI thread for the given display.

Usage

From source file:org.salever.swtjface.demo.binding.TreeViewerWithListFactory.java

License:Open Source License

/**
 * Launch the application/*from w  w  w  . j av  a 2  s .  c o m*/
 * 
 * @param args
 */
public static void main(String[] args) {
    Display display = Display.getDefault();
    Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
        public void run() {
            try {
                TreeViewerWithListFactory window = new TreeViewerWithListFactory();
                window.open();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:org.switchyard.tools.ui.editor.components.binding.sca.BindingSCAComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelJmsBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("SCA binding name should not be empty.", Status.WARNING)),
            null);/*from   w  w  w  .j  ava  2 s  .  co m*/
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("SCA binding name should not be empty.", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    final IObservableValue clusteredValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            SwitchyardPackage.eINSTANCE.getDocumentRoot_Clustered());

    binding = context.bindValue(SWTObservables.observeSelection(_clusteredCheckbox), clusteredValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    if (!_showConsumer) {
        final IObservableValue loadBalanceValue = new WritableValue(realm, null, String.class);
        final IObservableValue loadBalanceCustomValue = new WritableValue(realm, null, String.class);

        clusteredValue.addChangeListener(new IChangeListener() {

            @Override
            public void handleChange(ChangeEvent event) {
                boolean isClustered = ((Boolean) clusteredValue.getValue()).booleanValue();
                _loadBalancingCombo.getControl().setEnabled(isClustered);
                String value = (String) loadBalanceValue.getValue();
                if (!isClustered && value != null) {
                    loadBalanceValue.setValue(null);
                }
            }
        });

        loadBalanceValue.addChangeListener(new IChangeListener() {

            @Override
            public void handleChange(ChangeEvent event) {
                String value = (String) loadBalanceValue.getValue();
                boolean isCustom = false;
                if (value != null) {
                    isCustom = value.equals(Messages.constant_customLoadBalanceStrategy);
                }
                _loadBalancingCustomClassText.setEnabled(isCustom);
                _browseLoadBalancingClassButton.setEnabled(isCustom);
                if (!isCustom) {
                    loadBalanceCustomValue.setValue(null);
                }
            }
        });

        binding = context.bindValue(SWTObservables.observeText(_targetServiceText, new int[] { SWT.Modify }),
                ObservablesUtil.observeDetailValue(domain, _bindingValue,
                        SwitchyardPackage.eINSTANCE.getDocumentRoot_Target()),
                new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
        ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

        binding = context.bindValue(SWTObservables.observeText(_targetNamespaceText, new int[] { SWT.Modify }),
                ObservablesUtil.observeDetailValue(domain, _bindingValue,
                        SwitchyardPackage.eINSTANCE.getDocumentRoot_TargetNamespace()),
                new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
        ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

        binding = context.bindValue(ViewersObservables.observeSingleSelection(_loadBalancingCombo),
                loadBalanceValue,
                new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
        ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

        binding = context.bindValue(SWTObservables.observeText(_loadBalancingCustomClassText, SWT.Modify),
                loadBalanceCustomValue,
                new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
        ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

        ComputedValue computedLoadBalanceValue = new ComputedValue() {
            @Override
            protected Object calculate() {
                final String loadBalance = (String) loadBalanceValue.getValue();
                final String customLoadBalance = (String) loadBalanceCustomValue.getValue();
                if (loadBalance != null
                        && loadBalance.equalsIgnoreCase(Messages.constant_customLoadBalanceStrategy)
                        && customLoadBalance != null) {
                    return customLoadBalance;
                } else if (loadBalance != null
                        && !loadBalance.equalsIgnoreCase(Messages.constant_customLoadBalanceStrategy)) {
                    loadBalanceCustomValue.setValue(null);
                    return loadBalance;
                }
                return null;
            }

            protected void doSetValue(Object value) {
                final String strValue = (String) value;
                //"RoundRobinStrategy", "RandomStrategy"
                if (strValue != null && !strValue.equalsIgnoreCase("RoundRobinStrategy")
                        && !strValue.equalsIgnoreCase("RandomStrategy")) {
                    loadBalanceValue.setValue(Messages.constant_customLoadBalanceStrategy);
                    loadBalanceCustomValue.setValue(strValue);
                } else if (strValue != null) {
                    loadBalanceValue.setValue(strValue);
                    loadBalanceCustomValue.setValue(null);
                    setTextValueAndNotify(_loadBalancingCustomClassText, "", false);
                } else {
                    loadBalanceValue.setValue(null);
                    loadBalanceCustomValue.setValue(null);
                }
                getValue();
            }
        };

        // now bind the proxy into the binding
        binding = context.bindValue(computedLoadBalanceValue, ObservablesUtil.observeDetailValue(domain,
                _bindingValue, SwitchyardPackage.eINSTANCE.getDocumentRoot_LoadBalance()));
    }
}

From source file:org.switchyard.tools.ui.editor.components.camel.atom.CamelAtomConsumerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelAtomBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("Atom binding name should not be empty", Status.WARNING)),
            null);//from w  w  w.  ja  v  a 2 s.  c o m
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("Atom binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    CompoundValidator uriValidator = new CompoundValidator(
            new StringEmptyValidator("Feed URI may not be empty."),
            new URLValidator("Potential problem with Feed URI"));

    binding = context.bindValue(SWTObservables.observeText(_feedURIText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__FEED_URI),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(uriValidator),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    final IObservableValue splitEntriesCheckboxValue = SWTObservables.observeSelection(_splitEntriesCheckbox);
    final IObservableValue filterValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__FILTER);
    final IObservableValue lastUpdateValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__LAST_UPDATE);
    final IObservableValue sortEntriesValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__SORT_ENTRIES);

    binding = context.bindValue(splitEntriesCheckboxValue,
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__SPLIT_ENTRIES),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    _splitEntriesCheckbox.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            _filterCheckbox.setEnabled(_splitEntriesCheckbox.getSelection());
            _lastUpdateText.setEnabled(_splitEntriesCheckbox.getSelection());
            _sortEntriesCheckbox.setEnabled(_splitEntriesCheckbox.getSelection());
            if (!_splitEntriesCheckbox.getSelection()) {
                filterValue.setValue(Boolean.TRUE); // default
                lastUpdateValue.setValue(null); // default
                sortEntriesValue.setValue(Boolean.FALSE); // default
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    binding = context.bindValue(SWTObservables.observeSelection(_filterCheckbox), filterValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_lastUpdateText, new int[] { SWT.Modify }),
            lastUpdateValue,
            new EMFUpdateValueStrategyNullForEmptyString(
                    "Last Update must match the format yyyy-MM-ddTHH:mm:ss",
                    UpdateValueStrategy.POLICY_CONVERT),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_sortEntriesCheckbox), sortEntriesValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    FeaturePath path = FeaturePath.fromList(AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__CONSUME,
            AtomPackage.Literals.ATOM_SCHEDULED_POLL_CONSUMER_TYPE__DELAY);
    binding = context.bindValue(SWTObservables.observeText(_delayText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);
}

From source file:org.switchyard.tools.ui.editor.components.camel.atom.CamelAtomProducerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelAtomBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("Atom binding name should not be empty", Status.WARNING)),
            null);// ww w  .  j  a v  a 2 s.  c o  m
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("Atom binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    CompoundValidator uriValidator = new CompoundValidator(
            new StringEmptyValidator("Feed URI may not be empty."),
            new URLValidator("Potential problem with Feed URI"));

    binding = context.bindValue(SWTObservables.observeText(_feedURIText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__FEED_URI),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(uriValidator),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    final IObservableValue splitEntriesCheckboxValue = SWTObservables.observeSelection(_splitEntriesCheckbox);
    final IObservableValue filterValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__FILTER);
    final IObservableValue lastUpdateValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__LAST_UPDATE);
    final IObservableValue sortEntriesValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__SORT_ENTRIES);

    binding = context.bindValue(splitEntriesCheckboxValue,
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    AtomPackage.Literals.CAMEL_ATOM_BINDING_TYPE__SPLIT_ENTRIES),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    _splitEntriesCheckbox.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            _filterCheckbox.setEnabled(_splitEntriesCheckbox.getSelection());
            _lastUpdateText.setEnabled(_splitEntriesCheckbox.getSelection());
            _sortEntriesCheckbox.setEnabled(_splitEntriesCheckbox.getSelection());
            if (!_splitEntriesCheckbox.getSelection()) {
                filterValue.setValue(Boolean.TRUE); // default
                lastUpdateValue.setValue(null); // default
                sortEntriesValue.setValue(Boolean.FALSE); // default
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    binding = context.bindValue(SWTObservables.observeSelection(_filterCheckbox), filterValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_lastUpdateText, new int[] { SWT.Modify }),
            lastUpdateValue,
            new EMFUpdateValueStrategyNullForEmptyString(
                    "Last Update must match the format yyyy-MM-ddTHH:mm:ss",
                    UpdateValueStrategy.POLICY_CONVERT),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_sortEntriesCheckbox), sortEntriesValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);
}

From source file:org.switchyard.tools.ui.editor.components.camel.binding.CamelComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("Camel binding name should not be empty", Status.WARNING)),
            null);//from   ww w  . ja v a  2s  .  c  om
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("Camel binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    final IObservableValue configURIValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CorePackage.Literals.CAMEL_BINDING_TYPE__CONFIG_URI);

    CompoundValidator uriValidator = new CompoundValidator(
            new StringEmptyValidator(Messages.error_configUriMayNotBeEmpty),
            new URLValidator("Potential problem with Camel URI"));

    binding = context.bindValue(SWTObservables.observeText(_configURIText, new int[] { SWT.Modify }),
            configURIValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(uriValidator),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    if (_opSelectorComposite != null) {
        _opSelectorComposite.bindControls(domain, context);
    }
}

From source file:org.switchyard.tools.ui.editor.components.camel.cxf.CamelCxfConsumerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelCxfBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("CXF binding name should not be empty", Status.WARNING)),
            null);/* w w w  .  ja  va 2 s  .  co  m*/
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("CXF binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    CompoundValidator uriValidator = new CompoundValidator(
            new StringEmptyValidator("CXF URI may not be empty."),
            new URLValidator("Potential problem with CXF URI"));

    binding = context.bindValue(SWTObservables.observeText(_feedURIText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__CXF_URI),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(uriValidator),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_wsdlURLText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__WSDL_URL),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    IObservableValue dataFormatModelValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__DATA_FORMAT);

    binding = context.bindValue(ViewersObservables.observeSingleSelection(_dataFormatComboViewer),
            dataFormatModelValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    final IObservableValue relayHeaders = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__RELAY_HEADERS);

    dataFormatModelValue.addValueChangeListener(new IValueChangeListener() {
        @Override
        public void handleValueChange(ValueChangeEvent event) {
            Object value = event.getObservableValue().getValue();
            if (value != null && value instanceof String) {
                String strValue = (String) value;
                boolean isPojo = strValue.equalsIgnoreCase("POJO"); //$NON-NLS-1$ 
                _relayHeadersCheckbox.setEnabled(isPojo);
                if (isPojo) {
                    relayHeaders.setValue(Boolean.TRUE); // default to true
                } else {
                    relayHeaders.setValue(Boolean.FALSE);
                }
            }
        }
    });

    binding = context.bindValue(SWTObservables.observeText(_serviceClassText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__SERVICE_CLASS),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_serviceNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__SERVICE_NAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_portNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__PORT_NAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_relayHeadersCheckbox), relayHeaders,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_wrappedCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__WRAPPED),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    _wrappedStyleDetail = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__WRAPPED_STYLE);
    // otherWayThatDidntWork(context);
}

From source file:org.switchyard.tools.ui.editor.components.camel.cxf.CamelCxfProducerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelCxfBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("CXF binding name should not be empty", Status.WARNING)),
            null);/* w ww .  java 2s . c o  m*/
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("CXF binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    CompoundValidator uriValidator = new CompoundValidator(
            new StringEmptyValidator("CXF URI may not be empty."),
            new URLValidator("Potential problem with CXF URI"));
    binding = context.bindValue(SWTObservables.observeText(_feedURIText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__CXF_URI),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(uriValidator),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_wsdlURLText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__WSDL_URL),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    IObservableValue dataFormatModelValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__DATA_FORMAT);
    binding = context.bindValue(ViewersObservables.observeSingleSelection(_dataFormatComboViewer),
            dataFormatModelValue,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    final IObservableValue relayHeaders = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__RELAY_HEADERS);

    dataFormatModelValue.addValueChangeListener(new IValueChangeListener() {
        @Override
        public void handleValueChange(ValueChangeEvent event) {
            Object value = event.getObservableValue().getValue();
            if (value != null && value instanceof String) {
                String strValue = (String) value;
                boolean isPojo = strValue.equalsIgnoreCase("POJO"); //$NON-NLS-1$ 
                _relayHeadersCheckbox.setEnabled(isPojo);
                if (isPojo) {
                    relayHeaders.setValue(Boolean.TRUE); // default to true
                } else {
                    relayHeaders.setValue(Boolean.FALSE);
                }
            }
        }
    });

    binding = context.bindValue(SWTObservables.observeText(_serviceClassText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__SERVICE_CLASS),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_serviceNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__SERVICE_NAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_portNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__PORT_NAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_relayHeadersCheckbox), relayHeaders,
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_wrappedCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__WRAPPED),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    _wrappedStyleDetail = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__WRAPPED_STYLE);

    binding = context.bindValue(SWTObservables.observeText(_cxfClientPasswordText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__PASSWORD),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_cxfClientUserNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__USERNAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_defaultOpNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__DEFAULT_OPERATION_NAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_defaultOpNamespaceText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    CxfPackage.Literals.CAMEL_CXF_BINDING_TYPE__DEFAULT_OPERATION_NAMESPACE),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);
}

From source file:org.switchyard.tools.ui.editor.components.camel.file.CamelFileConsumerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelFileBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("File binding name should not be empty", Status.WARNING)),
            null);//w w  w  .  j ava  2  s. c  o  m
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("File binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_directoryText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__DIRECTORY),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyDirectory)),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_fileNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__FILE_NAME),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_autoCreateButton),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__AUTO_CREATE),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    bindConsumeControls(context, domain);

    _opSelectorComposite.bindControls(domain, context);
}

From source file:org.switchyard.tools.ui.editor.components.camel.file.CamelFileProducerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelFileBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("File binding name should not be empty", Status.WARNING)),
            null);/*www  . ja v a  2 s .  co m*/
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("File binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_directoryText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__DIRECTORY),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyDirectory)),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_fileNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__FILE_NAME),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_autoCreateButton),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__AUTO_CREATE),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    FeaturePath path = FeaturePath.fromList(FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__PRODUCE,
            FilePackage.Literals.FILE_PRODUCER_TYPE__FILE_EXIST);

    binding = context.bindValue(SWTObservables.observeText(_fileExistText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    path = FeaturePath.fromList(FilePackage.Literals.CAMEL_FILE_BINDING_TYPE__PRODUCE,
            FilePackage.Literals.FILE_PRODUCER_TYPE__TEMP_PREFIX);

    binding = context.bindValue(SWTObservables.observeText(_tempPrefixText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);
}

From source file:org.switchyard.tools.ui.editor.components.camel.ftp.CamelFTPConsumerComposite.java

License:Open Source License

private void bindControls(final DataBindingContext context) {
    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getTargetObject());
    final Realm realm = SWTObservables.getRealm(_nameText.getDisplay());

    _bindingValue = new WritableValue(realm, null, CamelFtpBindingType.class);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("FTP binding name should not be empty", Status.WARNING)),
            null);/*from   w  w w  . j  a va 2  s  .  c o m*/
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    /*
     * we also want to bind the name field to the binding name. note that
     * the model to target updater is configured to NEVER update. we want
     * the camel binding name to be the definitive source for this field.
     */
    binding = context.bindValue(SWTObservables.observeText(_nameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, ScaPackage.eINSTANCE.getBinding_Name()),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(
                            new StringEmptyValidator("FTP binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_directoryText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__DIRECTORY),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyDirectory)),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_fileNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__FILE_NAME),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_hostText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__HOST),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_portText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__PORT),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Port must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').")),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_usernameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__USERNAME),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_pwdText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__PASSWORD),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_autoCreateButton),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__AUTO_CREATE),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_binaryButton),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__BINARY),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    bindConsumeControls(context, domain);

    _opSelectorComposite.bindControls(domain, context);
}