Package org.eclipse.core.databinding.observable

Examples of org.eclipse.core.databinding.observable.IObservable


        if (targetValue instanceof IObservable) {
          return (IObservable) targetValue;
        }
      }

      IObservable observable = scopeManager.getObservable(widget, value,
          expressionPath.getStripedPath());
      if (observable != null) {
        while (observable instanceof IObservableValue
            && ((IObservableValue) observable).getValue() instanceof IObservable) {
          observable = (IObservable) ((IObservableValue) observable)
View Full Code Here


        currentPath = segment;
      } else if (segment != null) {
        currentPath = currentPath + '.' + segment;
      }

      IObservable segmentValue = scopeManager.getObservableValue(widget,
          value, currentPath);
      try {
        if (segmentValue == null) {
          if (segment != null) {
            segmentValue = createValueProperty(dataValue, segment,
View Full Code Here

      return segmentValue;
    }

    protected IObservable createValueProperty(Object object,
        String propertyName, Object targetType) {
      IObservable observable = null;
      Object type = null;
      if (targetType == null) {
        type = dataProvider.getModelService().toModelType(object);
      } else {
        type = targetType;
View Full Code Here

  public Object getValue(Class<?> targetType) {
    if (observableValue == null) {
      IObservableValue[] values = new IObservableValue[bindings.length];
      for (int i = 0; i < values.length; i++) {
        bindings[i].getValue(targetType);
        IObservable observable = bindings[i].getObservableSource();
        if (observable instanceof IObservableValue) {
          values[i] = (IObservableValue) observable;
        } else {
          LoggerManager.log("Binding expression has a problem with "
              + bindings[i].getPath());
View Full Code Here

      return;
    }
    this.context = context;
    this.value = value;
    IObservableFactory observableFactory = XWT.observableFactory(context, getContentPath(), UpdateSourceTrigger.Default);
    IObservable observable = observableFactory.createObservable(value);
   
    if (observable instanceof IObservableList) {
      delegate = new ObservableListTreeContentProvider(observableFactory, null);     
    }
    else if (observable instanceof IObservableSet) {
      delegate = new ObservableSetTreeContentProvider(observableFactory, null);           
    }
    else {
      throw new UnsupportedOperationException(observable.getClass().getName());
    }
  }
View Full Code Here

      Object source = getElementByName(target, sourceName);
      if (source == null) {
        throw new XWTException("No element is found with the name = "
            + sourceName);
      }
      IObservable observableValue = ScopeManager.observeValue(source,
          source, propertyName, UpdateSourceTrigger.PropertyChanged);
      observableValue.addChangeListener(changeListener);
    }
  }
View Full Code Here

    if (property != null) {
      final Object source = getElementByName(target, sourceName);
      if (source == null) {
        throw new XWTException("No element is found with the name = " + sourceName);
      }
      IObservable observableValue = ScopeManager.observeValue(source, source, property, UpdateSourceTrigger.PropertyChanged);
      observableValue.addChangeListener(new AbstractChangeListener(target) {
        public void handleChange(ChangeEvent event) {
          Class<?> valueType = JFaceXWTDataBinding.getValueType(source.getClass(), property);
          if (valueType == null) {
            LoggerManager.log("Type of the property " + property + " is not found in " + source
                .getClass().getName());
            return;
          }
          Widget widget = UserData.getWidget(source);
          if (widget == null) {
            return;
          }
         
          //
          // test value ==
          //
          Object realValue = value;
          if (value != null) {
            IConverter converter = XWT.findConvertor(value.getClass(), valueType);
            if (converter != null) {
              realValue = converter.convert(value);           
            }
          }
          Object newValue = event.getSource();
          if (newValue instanceof IObservableValue) {
            IObservableValue observableValue = (IObservableValue) newValue;
            newValue = observableValue.getValue();
          }
          if (newValue != null) {
            IConverter newConverter = XWT.findConvertor(newValue.getClass(), valueType);
            if (newConverter != null) {
              newValue = newConverter.convert(newValue);           
View Full Code Here

            break;
          }
        }
      }
      if (method != null) {
        IObservable observableValue = (IObservable) method
            .invoke(null, viewer);
        if (observableValue != null) {
          return observableValue;
        }
      }
View Full Code Here

  /**
   * Get bind value of two bindings.
   */
  public Object getValue(Class<?> targetType) {
    IObservable observableWidget = getObservableWidget();
    IObservable observableSource = getObservableSource(ScopeManager.VALUE);

    /*
     * If observableWidget is null, we need only return the data from
     * provider.
     */
 
View Full Code Here

    }
    return false;
  }

  public IObservable getObservableSource(int observeKind) {
    IObservable observableSource = getObservableSource();
    if (observableSource == null) {
      IDataProvider dataProvider = getDataProvider();
      observableSource = ScopeManager.observe(getControl(), dataProvider
          .getData(null), getSourcePropertyExpression(),
          getUpdateSourceTrigger(), observeKind);
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.observable.IObservable

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.