/**
   * @param composite
   * @return
   */
  private Composite createBooleanConfigurationComposite(Composite composite) {

    Composite booleanComposite = new Composite(composite, SWT.NONE);
    booleanComposite.setLayout(new GridLayout(2, false));
    Label nameLabel = new Label(booleanComposite, SWT.NONE);
    nameLabel.setText(Messages.AddSimulationDataWizardPage_ProbabilityOfTrueLabel);
    Text labelText = new Text(booleanComposite, SWT.BORDER);
    labelText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    //        ControlDecoration controlDecoration = new ControlDecoration(labelText,
    // SWT.LEFT|SWT.TOP);
    //        FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
    //                .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
    //        controlDecoration.setImage(fieldDecoration.getImage());
    //        controlDecoration.setDescriptionText(Messages.mustBeAPercentage);
    UpdateValueStrategy targetToModel = new UpdateValueStrategy();
    targetToModel.setConverter(
        StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), true));
    targetToModel.setAfterGetValidator(
        new ProbabilityValidator(
            new StringToDoubleValidator(
                StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), false))));

    Binding provider =
        context.bindValue(
            SWTObservables.observeText(labelText, SWT.Modify),
            PojoObservables.observeValue(this, "probabilityOfTrue"),
            targetToModel,
            new UpdateValueStrategy()
                .setConverter(
                    NumberToStringConverter.fromDouble(
                        BonitaNumberFormat.getPercentInstance(), true)));

    ControlDecorationSupport.create(provider, SWT.TOP | SWT.LEFT);
    return booleanComposite;
  }
Beispiel #2
0
  /**
   * Sets up data binding between the text fields and the connection details object. Also attaches a
   * "string required" validator to the "password" text field. This validator is configured to do
   * the following on validation failure<br>
   * <li>show an ERROR decorator
   * <li>disable the "Login" button
   */
  private void setupDataBinding() {
    DataBindingContext dataBindingContext =
        new DataBindingContext(SWTObservables.getRealm(Display.getCurrent()));
    UpdateValueStrategy passwordBindingStrategy =
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);

    // The Validator shows error decoration and disables OK button on
    // validation failure
    passwordBindingStrategy.setBeforeSetValidator(
        new StringRequiredValidator(
            "Please enter password!", guiHelper.createErrorDecoration(passwordText), okButton));

    dataBindingContext.bindValue(
        WidgetProperties.text(SWT.Modify).observe(passwordText),
        PojoProperties.value("password").observe(connectionDetails),
        passwordBindingStrategy,
        passwordBindingStrategy);

    UpdateValueStrategy userIdBindingStrategy =
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
    dataBindingContext.bindValue(
        WidgetProperties.text(SWT.Modify).observe(userIdText),
        PojoProperties.value("userId").observe(connectionDetails),
        userIdBindingStrategy,
        userIdBindingStrategy);
  }
  /** {@inheritDoc} */
  @Override
  public void setConverters(IConverter targetToModel, IConverter modelToTarget) {
    if (targetToModelStrategy == null) {
      targetToModelStrategy = new UpdateValueStrategy();
    }
    if (modelToTargetStrategy == null) {
      modelToTargetStrategy = new UpdateValueStrategy();
    }

    targetToModelStrategy.setConverter(targetToModel);
    modelToTargetStrategy.setConverter(modelToTarget);
  }
 protected void bindValidator(Text field, Object obj, String property, IValidator validator) {
   DataBindingContext bindingContext = new DataBindingContext();
   UpdateValueStrategy ttm = new UpdateValueStrategy();
   ttm.setBeforeSetValidator(validator);
   //
   IObservableValue countryTxtObserveTextObserveWidget =
       SWTObservables.observeText(field, SWT.Modify);
   IObservableValue currentAddressCountryObserveValue =
       PojoObservables.observeValue(obj, property);
   Binding binding =
       bindingContext.bindValue(
           countryTxtObserveTextObserveWidget, currentAddressCountryObserveValue, ttm, null);
   ControlDecorationSupport.create(binding, SWT.TOP | SWT.LEFT);
 }
  protected void bindSection() {
    if (context != null) {
      context.dispose();
    }
    context = new EMFDataBindingContext();
    if (getEObject() != null && dataTableViewer != null) {
      final IObservableList dataObservableList =
          EMFEditObservables.observeList(getEditingDomain(), getEObject(), getDataFeature());
      dataTableViewer.setInput(dataObservableList);
      final UpdateValueStrategy enableStrategy = new UpdateValueStrategy();
      enableStrategy.setConverter(
          new Converter(Data.class, Boolean.class) {

            @Override
            public Object convert(final Object fromObject) {
              return fromObject != null;
            }
          });

      context.bindValue(
          SWTObservables.observeEnabled(updateDataButton),
          ViewersObservables.observeSingleSelection(dataTableViewer),
          new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
          enableStrategy);
      context.bindValue(
          SWTObservables.observeEnabled(removeDataButton),
          ViewersObservables.observeSingleSelection(dataTableViewer),
          new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
          enableStrategy);

      if (promoteDataButton != null) {
        final UpdateValueStrategy enableMoveStrategy = new UpdateValueStrategy();
        enableMoveStrategy.setConverter(
            new Converter(Data.class, Boolean.class) {

              @Override
              public Object convert(final Object fromObject) {
                return fromObject != null
                    && ModelHelper.getParentProcess(getEObject()) != null
                    && !((Data) fromObject).isTransient();
              }
            });
        context.bindValue(
            SWTObservables.observeEnabled(promoteDataButton),
            ViewersObservables.observeSingleSelection(dataTableViewer),
            new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
            enableMoveStrategy);
      }
    }
  }
  @Override
  protected Binding createBinding(IObservableValue target, final IObservableValue model) {
    UpdateValueStrategy targetToModel = new UpdateValueStrategy();
    targetToModel.setBeforeSetValidator(
        new IValidator() {

          @Override
          public IStatus validate(Object input) {
            if (input == null || input.toString().isEmpty()) {
              return ValidationStatus.error(Messages.inputIsEmpty);
            }
            return Status.OK_STATUS;
          }
        });
    return context.bindValue(target, model, targetToModel, null);
  }
  @Override
  protected void bindExpression() {
    if (control.isVisible()) {
      super.bindExpression();
    } else {
      if (expressionBinding != null && externalDataBindingContext != null) {
        externalDataBindingContext.removeBinding(expressionBinding);
        expressionBinding.dispose();
      }
      final IObservableValue nameObservable = getExpressionNameObservable();
      final UpdateValueStrategy targetToModelNameStrategy = new UpdateValueStrategy();
      targetToModelNameStrategy.setConverter(
          new Converter(Boolean.class, String.class) {

            @Override
            public Object convert(final Object fromObject) {
              final String input = ((Boolean) fromObject).toString();
              updateContentType(ExpressionConstants.CONSTANT_TYPE);
              updateContent(getContentFromInput(input));
              refresh();
              return input;
            }
          });

      final UpdateValueStrategy modelToTargetNameStrategy = new UpdateValueStrategy();
      modelToTargetNameStrategy.setConverter(
          new Converter(String.class, Boolean.class) {

            @Override
            public Object convert(final Object fromObject) {
              if (fromObject != null) {
                final String input = fromObject.toString();
                if (input.equalsIgnoreCase(Boolean.TRUE.toString())) {
                  return true;
                }
              }
              return false;
            }
          });

      internalDataBindingContext.bindValue(
          SWTObservables.observeSelection(checkBoxControl),
          nameObservable,
          targetToModelNameStrategy,
          modelToTargetNameStrategy);
    }
  }
Beispiel #8
0
  private void bindControls() {

    // Bind source file path widget to UI model
    IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(_javaClassText);
    IObservableValue modelValue = null;
    if (isSourcePage()) {
      modelValue = BeanProperties.value(Model.class, "sourceFilePath").observe(model);
    } else {
      modelValue = BeanProperties.value(Model.class, "targetFilePath").observe(model);
    }
    UpdateValueStrategy strategy = new UpdateValueStrategy();
    strategy.setBeforeSetValidator(
        new IValidator() {

          @Override
          public IStatus validate(final Object value) {
            final String path = value == null ? null : value.toString().trim();
            if (path == null || path.isEmpty()) {
              return ValidationStatus.error(
                  "A source file path must be supplied for the transformation.");
            }
            NewTransformationWizard wizard = (NewTransformationWizard) getWizard();
            try {
              Class<?> tempClass = wizard.getLoader().loadClass(path);
              if (tempClass == null) {
                return ValidationStatus.error(
                    "Unable to find a source file with the supplied path");
              }
            } catch (ClassNotFoundException e) {
              return ValidationStatus.error("Unable to find a source file with the supplied path");
            }
            return ValidationStatus.ok();
          }
        });
    _binding = context.bindValue(widgetValue, modelValue, strategy, null);
    ControlDecorationSupport.create(
        _binding,
        decoratorPosition,
        _javaClassText.getParent(),
        new WizardControlDecorationUpdater());

    listenForValidationChanges();
  }
  private void createRelayCheck(Composite parent, Result notReferenced, FormToolkit toolkit) {
    Label l = toolkit.createLabel(parent, "Is Relay Port:", SWT.NONE);
    l.setLayoutData(new GridData(SWT.NONE));

    relayCheck = toolkit.createButton(parent, "", SWT.CHECK);
    relayCheck.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    relayCheck.setSelection(relay);
    relayCheck.setEnabled(notReferenced.isOk());

    RelayValidator validator = new RelayValidator();
    UpdateValueStrategy t2m = new UpdateValueStrategy();
    t2m.setAfterConvertValidator(validator);
    t2m.setBeforeSetValidator(validator);
    UpdateValueStrategy m2t = new UpdateValueStrategy();
    m2t.setAfterConvertValidator(validator);
    m2t.setBeforeSetValidator(validator);

    getBindingContext()
        .bindValue(
            SWTObservables.observeSelection(relayCheck),
            PojoObservables.observeValue(this, "relay"),
            t2m,
            m2t);

    if (notReferenced.isOk()) createDecorator(relayCheck, "");
    else createInfoDecorator(relayCheck, notReferenced.getMsg());
  }
  private void createNameAndDescription(Composite composite) {
    Label nameLabel = new Label(composite, SWT.NONE);
    nameLabel.setText(Messages.dataNameLabel);
    final Text labelText = new Text(composite, SWT.BORDER);
    labelText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    // Add an validator so that age can only be a number
    IValidator validator =
        new IValidator() {

          Set<String> existingDataNames = null;

          @Override
          public IStatus validate(Object arg0) {
            if (existingDataNames == null) {
              existingDataNames = new HashSet<String>();
              if (element != null) {
                for (SimulationData simuData : element.getSimulationData()) {
                  existingDataNames.add(simuData.getName());
                }
              }
            }

            if (existingDataNames.contains(labelText.getText())) {

              return ValidationStatus.error("Data name already exists.");
            }
            return ValidationStatus.ok();
          }
        };
    UpdateValueStrategy strategy = new UpdateValueStrategy();
    strategy.setBeforeSetValidator(validator);

    Binding bindingDataName =
        context.bindValue(
            SWTObservables.observeText(labelText, SWT.Modify),
            PojoObservables.observeValue(this, "dataName"),
            strategy,
            null);

    ControlDecorationSupport.create(bindingDataName, SWT.TOP | SWT.LEFT);
    // labelText.addModifyListener(updateButtonModifyListener) ;

    Label isExpressionLabel = new Label(composite, SWT.NONE);
    isExpressionLabel.setText(Messages.BasedOn);

    Composite radioBasedComposite = new Composite(composite, SWT.NONE);
    radioBasedComposite.setLayout(new GridLayout(2, true));

    isExpressionBased = new Button(radioBasedComposite, SWT.RADIO);
    isExpressionBased.setText(Messages.Expression);
    isExpressionBased.setSelection(expressionBased);
    isOtherBased = new Button(radioBasedComposite, SWT.RADIO);
    isOtherBased.setSelection(!expressionBased);
    isOtherBased.setText(Messages.AddSimulationDataWizardPage_probability);
    context.bindValue(
        SWTObservables.observeSelection(isExpressionBased),
        PojoObservables.observeValue(this, "expressionBased"));
    context.bindValue(
        SWTObservables.observeSelection(isOtherBased),
        PojoObservables.observeValue(this, "expressionBased"),
        new UpdateValueStrategy()
            .setConverter(
                new Converter(Boolean.class, Boolean.class) {
                  @Override
                  public Object convert(Object fromObject) {
                    return !(Boolean) fromObject;
                  }
                }),
        new UpdateValueStrategy()
            .setConverter(
                new Converter(Boolean.class, Boolean.class) {
                  @Override
                  public Object convert(Object fromObject) {
                    return !(Boolean) fromObject;
                  }
                }));

    Label expressionLabel = new Label(composite, SWT.NONE);
    expressionLabel.setText(Messages.Expression);

    ExpressionViewer expressionViewer =
        new ExpressionViewer(composite, SWT.BORDER, null); // FIXME: Expressionviewer
    expressionViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    if (element != null) {
      expressionViewer.setInput(element);
    } else {
      expressionViewer.setInput(data.eContainer());
    }
    expressionViewer.addFilter(
        new AvailableExpressionTypeFilter(
            new String[] {
              ExpressionConstants.CONSTANT_TYPE,
              ExpressionConstants.VARIABLE_TYPE,
              ExpressionConstants.SCRIPT_TYPE,
              ExpressionConstants.SIMULATION_VARIABLE_TYPE
            }));
    expressionViewer.setSelection(new StructuredSelection(dataExpression));

    context.bindValue(
        SWTObservables.observeVisible(expressionLabel),
        SWTObservables.observeSelection(isExpressionBased));
    context.bindValue(
        SWTObservables.observeVisible(expressionViewer.getControl()),
        SWTObservables.observeSelection(isExpressionBased));

    isOtherBased.addSelectionListener(updateButtonSelectionListener);
    isExpressionBased.addSelectionListener(updateButtonSelectionListener);
  }
  protected void showContent(String type) {
    IExpressionProvider provider =
        ExpressionEditorService.getInstance().getExpressionProvider(type);

    Assert.isNotNull(provider);

    for (Control c : contentComposite.getChildren()) {
      c.dispose();
    }

    if (currentExpressionEditor != null) {
      currentExpressionEditor.dispose();
    }

    currentExpressionEditor = provider.getExpressionEditor(inputExpression, context);
    currentExpressionEditor.setIsPageFlowContext(isPageFlowContext);
    if (currentExpressionEditor != null) {
      currentExpressionEditor.createExpressionEditor(contentComposite, isPassword);
      contentComposite.layout(true, true);
      if (helpControl != null) {
        //				helpControl.setVisible(currentExpressionEditor.provideDialogTray());
        helpControl.setVisible(false);
        if (currentExpressionEditor.provideDialogTray()) {
          ToolItem item = ((ToolBar) helpControl).getItem(0);
          item.setSelection(true);
          openTrayListener.handleEvent(new Event());
        } else if (getTray() != null) {
          closeTray();
        }
      }
      if (dataBindingContext != null) {
        dataBindingContext.dispose();
      }
      dataBindingContext = new EMFDataBindingContext();

      UpdateValueStrategy selectionToExpressionType = new UpdateValueStrategy();
      IConverter convert =
          new Converter(IExpressionProvider.class, String.class) {

            @Override
            public Object convert(Object arg0) {
              return ((IExpressionProvider) arg0).getExpressionType();
            }
          };
      selectionToExpressionType.setConverter(convert);

      if (domain != null) {
        domain
            .getCommandStack()
            .execute(
                SetCommand.create(
                    domain, inputExpression, ExpressionPackage.Literals.EXPRESSION__TYPE, type));
      } else {
        inputExpression.setType(type);
      }
      currentExpressionEditor.bindExpression(
          dataBindingContext, context, inputExpression, viewerTypeFilters, expressionViewer);
      currentExpressionEditor.addListener(
          new Listener() {
            @Override
            public void handleEvent(Event event) {
              Button okButton = getButton(OK);
              if (okButton != null && !okButton.isDisposed()) {
                okButton.setEnabled(currentExpressionEditor.canFinish());
              }
            }
          });
      DialogSupport.create(this, dataBindingContext);
    }
  }
 protected UpdateValueStrategy createRequiredUpdateStrategy(String validationMessage) {
   UpdateValueStrategy updateStrategy = new UpdateValueStrategy();
   updateStrategy.setBeforeSetValidator(new RequiredValidator(validationMessage));
   return updateStrategy;
 }
  @Override
  public void bindExpression(
      final EMFDataBindingContext dataBindingContext,
      final EObject context,
      final Expression inputExpression,
      final ViewerFilter[] filters,
      final ExpressionViewer expressionViewer) {
    final EObject finalContext = context;
    addExpressionButton.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(final SelectionEvent e) {
            super.widgetSelected(e);
            expressionButtonListener(finalContext);
          }
        });
    editorInputExpression = inputExpression;
    fillViewerInput(context);

    final IObservableValue contentObservable =
        EMFObservables.observeValue(
            inputExpression, ExpressionPackage.Literals.EXPRESSION__CONTENT);
    final IObservableValue nameObservable =
        EMFObservables.observeValue(inputExpression, ExpressionPackage.Literals.EXPRESSION__NAME);
    final IObservableValue returnTypeObservable =
        EMFObservables.observeValue(
            inputExpression, ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE);
    final IObservableValue referenceObservable =
        EMFObservables.observeValue(
            inputExpression, ExpressionPackage.Literals.EXPRESSION__REFERENCED_ELEMENTS);

    final UpdateValueStrategy selectionToName = new UpdateValueStrategy();
    final IConverter nameConverter =
        new Converter(Parameter.class, String.class) {

          @Override
          public Object convert(final Object parameter) {
            return ((Parameter) parameter).getName();
          }
        };
    selectionToName.setConverter(nameConverter);

    final UpdateValueStrategy selectionToContent = new UpdateValueStrategy();
    final IConverter contentConverter =
        new Converter(Parameter.class, String.class) {

          @Override
          public Object convert(final Object parameter) {
            return ((Parameter) parameter).getName();
          }
        };
    selectionToContent.setConverter(contentConverter);

    final UpdateValueStrategy selectionToReturnType = new UpdateValueStrategy();
    final IConverter returnTypeConverter =
        new Converter(Parameter.class, String.class) {

          @Override
          public Object convert(final Object parameter) {
            return ((Parameter) parameter).getTypeClassname();
          }
        };
    selectionToReturnType.setConverter(returnTypeConverter);

    final UpdateValueStrategy selectionToReferencedData = new UpdateValueStrategy();
    final IConverter referenceConverter =
        new Converter(Parameter.class, List.class) {

          @Override
          public Object convert(final Object parameter) {
            return Collections.singletonList(parameter);
          }
        };
    selectionToReferencedData.setConverter(referenceConverter);

    final UpdateValueStrategy referencedDataToSelection = new UpdateValueStrategy();
    final IConverter referencetoDataConverter =
        new Converter(List.class, Parameter.class) {

          @SuppressWarnings("unchecked")
          @Override
          public Object convert(final Object parameterList) {
            if (!((List<Parameter>) parameterList).isEmpty()) {
              final Parameter p = ((List<Parameter>) parameterList).get(0);
              final Collection<Parameter> inputParameters =
                  (Collection<Parameter>) viewer.getInput();
              for (final Parameter param : inputParameters) {
                if (param.getName().equals(p.getName())
                    && param.getTypeClassname().equals(p.getTypeClassname())) {
                  return param;
                }
              }
            }
            return null;
          }
        };
    referencedDataToSelection.setConverter(referencetoDataConverter);

    dataBindingContext.bindValue(
        ViewersObservables.observeSingleSelection(viewer),
        nameObservable,
        selectionToName,
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    dataBindingContext.bindValue(
        ViewersObservables.observeSingleSelection(viewer),
        contentObservable,
        selectionToContent,
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    dataBindingContext.bindValue(
        ViewersObservables.observeSingleSelection(viewer),
        returnTypeObservable,
        selectionToReturnType,
        new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER));
    dataBindingContext.bindValue(
        ViewersObservables.observeSingleSelection(viewer),
        referenceObservable,
        selectionToReferencedData,
        referencedDataToSelection);
    dataBindingContext.bindValue(
        SWTObservables.observeText(typeText, SWT.Modify), returnTypeObservable);
  }
  private DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    //
    IObservableValue btnCaseSensitiveObserveSelectionObserveWidget =
        SWTObservables.observeSelection(btnCaseSensitive);
    IObservableValue ecgModelCaseSensitiveObserveValue =
        PojoObservables.observeValue(ecgModel, "caseSensitive"); // $NON-NLS-1$
    bindingContext.bindValue(
        btnCaseSensitiveObserveSelectionObserveWidget,
        ecgModelCaseSensitiveObserveValue,
        null,
        null);
    //
    IObservableValue btnRegualrExpressionObserveSelectionObserveWidget =
        SWTObservables.observeSelection(btnRegualarExpression);
    IObservableValue ecgModelRegularExpressionObserveValue =
        PojoObservables.observeValue(ecgModel, "regularExpression"); // $NON-NLS-1$
    bindingContext.bindValue(
        btnRegualrExpressionObserveSelectionObserveWidget,
        ecgModelRegularExpressionObserveValue,
        null,
        null);
    //
    IObservableValue containingTextObserveTextObserveWidget =
        SWTObservables.observeSelection(containingText);
    IObservableValue ecgModelSearchStringObserveValue =
        PojoObservables.observeValue(ecgModel, "searchString"); // $NON-NLS-1$
    bindingContext.bindValue(
        containingTextObserveTextObserveWidget, ecgModelSearchStringObserveValue, null, null);
    //
    IObservableValue containingEndTextObserveTextObserveWidget =
        SWTObservables.observeSelection(containingEndText);
    IObservableValue ecgModelSearchEndStringObserveValue =
        PojoObservables.observeValue(ecgModel, "searchEndString"); // $NON-NLS-1$
    bindingContext.bindValue(
        containingEndTextObserveTextObserveWidget, ecgModelSearchEndStringObserveValue, null, null);
    //
    IObservableValue consoleListObserveSelectionObserveWidget =
        SWTObservables.observeSelection(consoleList);
    IObservableValue ecgModelSourceObserveValue =
        PojoObservables.observeValue(ecgModel, "source"); // $NON-NLS-1$
    UpdateValueStrategy name2TextConsoleStrategy = new UpdateValueStrategy();
    name2TextConsoleStrategy.setConverter(new Name2TextConsoleConverter());
    UpdateValueStrategy textConsole2NameStrategy = new UpdateValueStrategy();
    textConsole2NameStrategy.setConverter(new TextConsole2NameConverter());
    bindingContext.bindValue(
        consoleListObserveSelectionObserveWidget,
        ecgModelSourceObserveValue,
        name2TextConsoleStrategy,
        textConsole2NameStrategy);
    // Listener for update dispose-state
    ecgModelSourceObserveValue.addValueChangeListener(
        new IValueChangeListener() {

          @Override
          public void handleValueChange(ValueChangeEvent event) {
            // when we change back to the origin source console we must set the origin disposal
            // state
            if (ecgModelOrig.getSource() == ecgModel.getSource()) {
              ecgModel.setSourceDisposed(ecgModelOrig.isSourceDisposed());
            } else {
              ecgModel.setSourceDisposed(false);
            }
          }
        });
    //
    IObservableValue btnNotMatchingObserveSelectionObserveWidget =
        SWTObservables.observeSelection(btnNotMatching);
    IObservableValue ecgModelNotMatchingObserveValue =
        PojoObservables.observeValue(ecgModel, "notMatching"); // $NON-NLS-1$
    bindingContext.bindValue(
        btnNotMatchingObserveSelectionObserveWidget, ecgModelNotMatchingObserveValue, null, null);
    //
    IObservableValue btnWholeWordObserveSelectionObserveWidget =
        SWTObservables.observeSelection(btnWholeWord);
    IObservableValue ecgModelWholeWordObserveValue =
        PojoObservables.observeValue(ecgModel, "wholeWord"); // $NON-NLS-1$
    bindingContext.bindValue(
        btnWholeWordObserveSelectionObserveWidget, ecgModelWholeWordObserveValue, null, null);
    //
    IObservableValue btnSetEndMarkerObserveSelectionObserveWidget =
        SWTObservables.observeSelection(btnSetEndMarker);
    IObservableValue ecgModelRangeMatchingObserveValue =
        PojoObservables.observeValue(ecgModel, "rangeMatching"); // $NON-NLS-1$
    bindingContext.bindValue(
        btnSetEndMarkerObserveSelectionObserveWidget,
        ecgModelRangeMatchingObserveValue,
        null,
        null);
    //

    //
    ecgModelRangeMatchingObserveValue.addValueChangeListener(
        new IValueChangeListener() {

          @Override
          public void handleValueChange(ValueChangeEvent event) {
            updateRangeMatchingArrangement();
          }
        });

    //
    ecgModelRegularExpressionObserveValue.addValueChangeListener(
        new IValueChangeListener() {

          @Override
          public void handleValueChange(ValueChangeEvent event) {
            updateLblText();
          }
        });

    return bindingContext;
  }