Package org.eclipse.core.databinding.observable.value

Examples of org.eclipse.core.databinding.observable.value.IObservableValue


    bindBeanProperty(dataBindingContext, mmng, bean, propertyName, validator, value, control);
  }

  public static void bindBeanProperty(DataBindingContext dataBindingContext, final IMessageManager mmng,
      Object bean, final String propertyName, IValidator validator, IObservableValue value, final Control control) {
    IObservableValue modelValue = BeanProperties.value(propertyName).observe(bean);

    UpdateValueStrategy targetToModel = new TrimmingUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
    //UpdateValueStrategy modelToTarget = new UpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);
    UpdateValueStrategy modelToTarget = new TrimmingUpdateValueStrategy(UpdateValueStrategy.POLICY_UPDATE);

    if (validator != null) {
      targetToModel.setBeforeSetValidator(validator);
      modelToTarget.setBeforeSetValidator(validator);
    }

    Binding bindValue = dataBindingContext.bindValue(value, modelValue, targetToModel, modelToTarget);

    final IObservableValue validationStatus = bindValue.getValidationStatus();
    validationStatus.addChangeListener(new MessageChangeListener(validationStatus, control,
        propertyName, mmng));

    // we need to call validation here otherwise the fresh initiated fields
    // would
    // have no error decoration if field is invalid on init phase
View Full Code Here


  public static boolean isValid(DataBindingContext context) {
    IObservableList validationStatusProviders = context.getValidationStatusProviders();
    for (Object object : validationStatusProviders) {
      if (object instanceof ValidationStatusProvider) {
        ValidationStatusProvider provider = (ValidationStatusProvider) object;
        IObservableValue validationStatus = provider.getValidationStatus();
        if (validationStatus != null) {
          Object value = validationStatus.getValue();
          if (value instanceof BindingStatus) {
            BindingStatus status = (BindingStatus) value;
            if (!status.isOK()) {
              return false;
            }
View Full Code Here

    targetToModel.setBeforeSetValidator(new MandatoryValidator(labelText));
    modelToTarget.setBeforeSetValidator(new MandatoryValidator(labelText));

    Binding bindValue = dataBindingContext.bindList(observe, modelList);

    final IObservableValue validationStatus = bindValue.getValidationStatus();
    validationStatus.addChangeListener(new MessageChangeListener(validationStatus, profilesViewer.getControl(),
        propertyName, mmgr));
  }
View Full Code Here

    exportFileTypeCombo.setToolTipText(Messages.SapConnectionConfigurationExportPage_ExportFileType);
    exportFileTypeCombo.setItems(new String[] {ExportFileType.BLUEPRINT.getDisplay(), ExportFileType.SPRING.getDisplay()});
    exportFileTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    exportFileTypeCombo.select(0);

    IObservableValue observeSingleSelectionExportFileTypeComboObserveWidget = WidgetProperties.singleSelectionIndex().observe(exportFileTypeCombo);
    IObservableValue exportFileTypeObserveValue = BeansObservables.observeValue(exportSettings, "exportFileType"); //$NON-NLS-1$
    UpdateValueStrategy combo2ExportFileTypeStrategy = new UpdateValueStrategy();
    combo2ExportFileTypeStrategy.setConverter(new ExportFileTypeComboSelection2ExportFileTypeConverter());
    UpdateValueStrategy exportFileType2ComboStrategy = new UpdateValueStrategy();
    exportFileType2ComboStrategy.setConverter(new ExportFileType2ExportFileTypeComboSelectionConverter());
    context.bindValue(observeSingleSelectionExportFileTypeComboObserveWidget, exportFileTypeObserveValue, combo2ExportFileTypeStrategy, exportFileType2ComboStrategy);
View Full Code Here

  }
 
  protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    //
    IObservableValue observeTextServerNameTextObserveWidget = WidgetProperties.text(SWT.Modify).observe(serverNameText);
    IObservableValue serverDataServerNameObserveValue = EMFEditProperties.value(editingDomain, Literals.SERVER_DATA_STORE_ENTRY__KEY).observe(serverDataStoreEntry);
    bindingContext.bindValue(observeTextServerNameTextObserveWidget, serverDataServerNameObserveValue, null, null);
    //
    return bindingContext;
  }
View Full Code Here

  }
 
  protected DataBindingContext initDataBindings() {
    DataBindingContext bindingContext = new DataBindingContext();
    //
    IObservableValue observeTextDestinationNameTextObserveWidget = WidgetProperties.text(SWT.Modify).observe(destinationNameText);
    IObservableValue destinationDataDestinationNameObserveValue = EMFEditProperties.value(editingDomain, Literals.DESTINATION_DATA_STORE_ENTRY__KEY).observe(destinationDataStoreEntry);
    bindingContext.bindValue(observeTextDestinationNameTextObserveWidget, destinationDataDestinationNameObserveValue, null, null);
    //
    return bindingContext;
  }
View Full Code Here

    Object eGet = be.eGet(a);
    if (eGet != null) {
      text.setText(eGet.toString());
    }

    IObservableValue textObserver = SWTObservables.observeText(text, SWT.Modify);
    textObserver.addValueChangeListener(new IValueChangeListener() {

      @SuppressWarnings("restriction")
      @Override
      public void handleValueChange(final ValueChangeEvent e) {
View Full Code Here

    bindBoolean(a, button, be);
  }

  protected void bindBoolean(final EStructuralFeature a, final Button button, final EObject object) {
    button.setSelection((Boolean) object.eGet(a));
    IObservableValue buttonObserver = SWTObservables.observeSelection(button);
    buttonObserver.addValueChangeListener(new IValueChangeListener() {
     
      @SuppressWarnings("restriction")
      @Override
      public void handleValueChange(ValueChangeEvent event) {
View Full Code Here

    Object eGet = be.eGet(a);
    if (eGet != null) {
      text.setText(eGet.toString());
    }

    IObservableValue textObserveTextObserveWidget = SWTObservables.observeText(text, SWT.Modify);
    textObserveTextObserveWidget.addValueChangeListener(new IValueChangeListener() {
      @Override
      public void handleValueChange(ValueChangeEvent event) {

        try {
          final int i = Integer.parseInt(text.getText());
View Full Code Here

        return mapping;
      }
    };
   
    //mapping node
    IObservableValue observedMapping = InstanceObservables.observeValue(
        container, observingMapping);
   
    //remove existing bindings
    for (Binding binding : mappingBindingList) {
      binding.dispose();
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.observable.value.IObservableValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.