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.switchyard.tools.ui.editor.components.camel.ftp.CamelFTPConsumerMoveAndPollComposite.java

License:Open Source License

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

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

    FeaturePath path = FeaturePath.fromList(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__CONSUME,
            FtpPackage.Literals.REMOTE_FILE_CONSUMER_TYPE__PRE_MOVE);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_preMoveText, 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__MOVE);

    binding = context.bindValue(SWTObservables.observeText(_moveText, 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__MOVE_FAILED);

    binding = context.bindValue(SWTObservables.observeText(_moveFailedText, 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__DELAY);

    binding = context.bindValue(SWTObservables.observeText(_delayText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Delay must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').")),
            null);//  w  ww  .j a v  a 2  s  .  c  om
    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__MAX_MESSAGES_PER_POLL);

    binding = context.bindValue(SWTObservables.observeText(_maxMessagesPerPollText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Max Messages per Poll 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);
}

From source file:org.switchyard.tools.ui.editor.components.camel.ftp.CamelFTPProducerComposite.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);/* w  w w  .  j  a 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("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);

    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.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);/*  w  w w  . j av a2  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.CamelFTPSConsumerMoveAndPollComposite.java

License:Open Source License

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

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

    FeaturePath path = FeaturePath.fromList(FtpPackage.Literals.CAMEL_FTP_BINDING_TYPE__CONSUME,
            FtpPackage.Literals.REMOTE_FILE_CONSUMER_TYPE__PRE_MOVE);

    org.eclipse.core.databinding.Binding binding = context.bindValue(
            SWTObservables.observeText(_preMoveText, 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__MOVE);

    binding = context.bindValue(SWTObservables.observeText(_moveText, 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__MOVE_FAILED);

    binding = context.bindValue(SWTObservables.observeText(_moveFailedText, 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__DELAY);

    binding = context.bindValue(SWTObservables.observeText(_delayText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Delay must be a valid numeric value or follow the pattern for escaped properties (i.e. '${propName}').")),
            null);/*from w  ww.j  a v a2  s. c  o  m*/
    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__MAX_MESSAGES_PER_POLL);

    binding = context.bindValue(SWTObservables.observeText(_maxMessagesPerPollText, new int[] { SWT.Modify }),
            ObservablesUtil.observeDetailValue(domain, _bindingValue, path),
            new EMFUpdateValueStrategyNullForEmptyString(null, UpdateValueStrategy.POLICY_CONVERT)
                    .setAfterConvertValidator(new EscapedPropertyIntegerValidator(
                            "Max Messages per Poll 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);
}

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 a2s. 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);/*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("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 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);/*from   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("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);

    bindConsumerControls(context, domain);
}

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);/* ww w .j a va  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("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);// www . j av  a2 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);
}