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

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

Introduction

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

Prototype

@Deprecated
public static ISWTObservableValue observeSelection(Control control) 

Source Link

Document

Returns an observable observing the selection attribute of the provided control.

Usage

From source file:org.switchyard.tools.ui.editor.components.camel.ftps.CamelFTPSConsumerComposite.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, CamelFtpsBindingType.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("FTPS binding name should not be empty", Status.WARNING)),
            null);/*from   w  ww.  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("FTPS 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);

    bindConsumerControls(context, domain);

    _opSelectorComposite.bindControls(domain, context);
}

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

License:Open Source License

private void bindConsumerControls(final DataBindingContext context, final EditingDomain domain) {
    FeaturePath path = FeaturePath.fromList(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__CONSUME,
            FtpPackage.Literals.REMOTE_FILE_CONSUMER_TYPE__INCLUDE);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_includeText, 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(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__CONSUME,
            FtpPackage.Literals.REMOTE_FILE_CONSUMER_TYPE__EXCLUDE);

    binding = context.bindValue(SWTObservables.observeText(_excludeText, 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(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__CONSUME,
            FtpPackage.Literals.REMOTE_FILE_CONSUMER_TYPE__DELETE);
    binding = context.bindValue(SWTObservables.observeSelection(_deleteButton),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    path = FeaturePath.fromList(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__CONSUME,
            FtpPackage.Literals.REMOTE_FILE_CONSUMER_TYPE__RECURSIVE);
    binding = context.bindValue(SWTObservables.observeSelection(_recursiveButton),
            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.ftps.CamelFTPSProducerComposite.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, CamelFtpsBindingType.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("FTPS binding name should not be empty", Status.WARNING)),
            null);/*from w ww .  j  a  v a  2s .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("FTPS 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);

    FeaturePath path = FeaturePath.fromList(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__PRODUCE,
            FtpPackage.Literals.REMOTE_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);

    path = FeaturePath.fromList(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__PRODUCE,
            FtpPackage.Literals.REMOTE_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);

}

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

License:Open Source License

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

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

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            ViewersObservables.observeSingleSelection(_securityProtocolCombo),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTPS_BINDING_TYPE__SECURITY_PROTOCOL));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(ViewersObservables.observeSingleSelection(_execProtCombo), ObservablesUtil
            .observeDetailValue(domain, _bindingValue, FtpPackage.Literals.CAMEL_FTPS_BINDING_TYPE__EXEC_PROT));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeSelection(_isImplicitCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    FtpPackage.Literals.CAMEL_FTPS_BINDING_TYPE__IS_IMPLICIT));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

}

From source file:org.switchyard.tools.ui.editor.components.camel.jms.CamelJmsComposite.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("JMS binding name should not be empty", Status.WARNING)),
            null);// ww w .ja  va 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("JMS binding name should not be empty", Status.WARNING)),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    _queueValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__QUEUE);

    _queueNameBinding = context
            .bindValue(SWTObservables.observeText(_queueNameText, new int[] { SWT.Modify }), _queueValue,
                    new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                            .setAfterConvertValidator(new StringEmptyValidator("Queue may not be empty.")),
                    null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(_queueNameBinding), SWT.TOP | SWT.LEFT);

    _topicValue = ObservablesUtil.observeDetailValue(domain, _bindingValue,
            JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__TOPIC);
    _topicNameBinding = context
            .bindValue(SWTObservables.observeText(_topicNameText, new int[] { SWT.Modify }), _topicValue,
                    new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                            .setAfterConvertValidator(new StringEmptyValidator("Topic may not be empty.")),
                    null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(_topicNameBinding), SWT.TOP | SWT.LEFT);

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

    binding = context.bindValue(SWTObservables.observeText(_concurrentConsumersText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__CONCURRENT_CONSUMERS),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Concurrent Consumers 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(_maxConcurrentConsumersText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__MAX_CONCURRENT_CONSUMERS),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Max Concurrent Consumers 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(_replyToText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__REPLY_TO),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    if (_requestTimeOutText != null && !_requestTimeOutText.isDisposed()) {
        binding = context.bindValue(SWTObservables.observeText(_requestTimeOutText, new int[] { SWT.Modify }),
                ObservablesUtil.observeDetailValue(domain, _bindingValue,
                        JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__REQUEST_TIMEOUT),
                new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                        .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                                "Request Timeout 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(_transactionManagerText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__TRANSACTION_MANAGER),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

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

    binding = context.bindValue(SWTObservables.observeText(_selectorText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    JmsPackage.Literals.CAMEL_JMS_BINDING_TYPE__SELECTOR),
            new EMFUpdateValueStrategyNullForEmptyString("", UpdateValueStrategy.POLICY_CONVERT), 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.jpa.CamelJPAConsumerComposite.java

License:Open Source License

private void bindConsumerControls(final DataBindingContext context, final EditingDomain domain) {
    FeaturePath path = FeaturePath.fromList(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__CONSUME_DELETE);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeSelection(_deleteCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    path = FeaturePath.fromList(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__CONSUME_LOCK_ENTITY);

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

    path = FeaturePath.fromList(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__MAXIMUM_RESULTS);

    binding = context.bindValue(SWTObservables.observeText(_maximumResultsText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString("Maximum Results must be a valid number.",
                    UpdateValueStrategy.POLICY_CONVERT).setAfterConvertValidator(
                            new IntegerValidator("Maximum Results must be a valid number.")),
            null);//from   w ww.ja  v  a  2 s.  c om
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    path = FeaturePath.fromList(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__CONSUMER_QUERY);

    binding = context.bindValue(SWTObservables.observeText(_queryText, 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(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__CONSUMER_NATIVE_QUERY);

    binding = context.bindValue(SWTObservables.observeText(_nativeQueryText, 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(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__CONSUMER_NAMED_QUERY);

    binding = context.bindValue(SWTObservables.observeText(_namedQueryText, 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(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__CONSUME,
            JpaPackage.Literals.JPA_CONSUMER_TYPE__CONSUMER_TRANSACTED);
    binding = context.bindValue(SWTObservables.observeSelection(_transactedCheckbox),
            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.jpa.CamelJPAProducerComposite.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, CamelJpaBindingType.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("JPA binding name should not be empty", Status.WARNING)),
            null);/*w  w  w  .  j a va2  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("JPA 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(_entityClassNameText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__ENTITY_CLASS_NAME),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyEntityClassName)),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

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

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

    FeaturePath path = FeaturePath.fromList(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__PRODUCE,
            JpaPackage.Literals.JPA_PRODUCER_TYPE__FLUSH_ON_SEND);
    binding = context.bindValue(SWTObservables.observeSelection(_flushOnSendCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    path = FeaturePath.fromList(JpaPackage.Literals.CAMEL_JPA_BINDING_TYPE__PRODUCE,
            JpaPackage.Literals.JPA_PRODUCER_TYPE__USE_PERSIST);
    binding = context.bindValue(SWTObservables.observeSelection(_usePersistCheckbox),
            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.mail.CamelMailConsumerComposite.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, CamelMailBindingType.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("Mail binding name should not be empty", Status.WARNING)),
            null);/*from  w ww.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("Mail 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(_hostText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__HOST),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyHost)),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    binding = context.bindValue(SWTObservables.observeText(_portText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__PORT),
            new EMFUpdateValueStrategyNullForEmptyString(
                    "Port must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').",
                    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);

    FeaturePath path = FeaturePath.fromList(MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME,
            MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__FETCH_SIZE);

    binding = context.bindValue(SWTObservables.observeText(_fetchSizeText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(
                    "Fetch Size must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').",
                    UpdateValueStrategy.POLICY_CONVERT)
                            .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                                    "Fetch Size 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);

    path = FeaturePath.fromList(MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME,
            MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__ACCOUNT_TYPE);
    binding = context.bindValue(ViewersObservables.observeSingleSelection(_accountTypeCombo),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

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

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

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

    path = FeaturePath.fromList(MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME,
            MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__UNSEEN);
    binding = context.bindValue(SWTObservables.observeSelection(_unseenCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

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

    path = FeaturePath.fromList(MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__CONSUME,
            MailPackage.Literals.CAMEL_MAIL_CONSUMER_TYPE__DELETE);
    binding = context.bindValue(SWTObservables.observeSelection(_deleteCheckbox),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    _opSelectorComposite.bindControls(domain, context);
}

From source file:org.switchyard.tools.ui.editor.components.camel.mail.CamelMailProducerComposite.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, CamelMailBindingType.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("Mail 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("Mail 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(_hostText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    MailPackage.Literals.CAMEL_MAIL_BINDING_TYPE__HOST),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new StringEmptyValidator(Messages.error_emptyHost)),
            null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

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

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

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

    bindProducerControls(context, domain, realm);

}

From source file:org.switchyard.tools.ui.editor.components.camel.mqtt.CamelMQTTProducerComposite.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, CamelMqttBindingType.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("MQTT binding name should not be empty", Status.WARNING)),
            null);//from w  w  w.j a v  a 2s .c o  m
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

    CompoundValidator uriValidator = new CompoundValidator(new URLValidator("Potential problem with Host URI"));

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

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

    binding = context.bindValue(SWTObservables.observeText(_connectAttemptsMaxText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    MqttPackage.Literals.CAMEL_MQTT_BINDING_TYPE__CONNECT_ATTEMPTS_MAX),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Connect Attempts Max 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(_reconnectAttemptsMaxText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    MqttPackage.Literals.CAMEL_MQTT_BINDING_TYPE__RECONNECT_ATTEMPTS_MAX),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Reconnect Attempts Max 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(ViewersObservables.observeSingleSelection(_qosCombo),
            ObservablesUtil.observeDetailValue(domain, _bindingValue,
                    MqttPackage.Literals.CAMEL_MQTT_BINDING_TYPE__QUALITY_OF_SERVICE),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT), null);
    ControlDecorationSupport.create(SWTValueUpdater.attach(binding), SWT.TOP | SWT.LEFT);

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