Package org.eclipse.core.databinding.observable

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


      targetProperty = ModelUtils.normalizePropertyName(targetProperty);
      int observeKind = ScopeManager.AUTO;
      if (host instanceof Viewer && "input".equals(targetProperty)) {
        // It is possible to use List
        getObservableSource(ScopeManager.COLLECTION);
        IObservable observableSource = getObservableSource();
        if (observableSource instanceof IObservableList) {
          return null;
        } else if (observableSource instanceof IObservableSet) {
          return null;
        }
View Full Code Here


      Label label = toolkit.createLabel(parent, labelText);
    }

    Control widget;
    Class refType = isBeanRef(value, propertyName);
    IObservable observable;
    if (boolean.class.isAssignableFrom(propertyType) || Boolean.class.isAssignableFrom(propertyType)) {
      Button checkbox = new Button(parent, SWT.CHECK | SWT.BORDER);
      widget = checkbox;
      ISWTObservableValue textValue = Forms.observe(checkbox);
      observable = textValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, textValue, checkbox);
    } else if (refType != null) {
      Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
      String[] beanRefs = getBeanRefs(refType);
      combo.setItems(beanRefs);
      toolkit.adapt(combo, true, true);
      widget = combo;

      ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
      observable = comboValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, comboValue, combo);
    } else if (isEndpointUri(value, propertyName)) {
      Combo combo = new Combo(parent, SWT.NONE | SWT.BORDER);
      combo.setItems(getEndpointUris());
      toolkit.adapt(combo, true, true);
      widget = combo;

      ISWTObservableValue comboValue = WidgetProperties.selection().observe(combo);
      observable = comboValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, comboValue, combo);
    } else if (Enum.class.isAssignableFrom(propertyType)) {
      ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY | SWT.BORDER);
      combo.setContentProvider(ArrayContentProvider.getInstance());
      combo.setInput(getEnumValues((Class<? extends Enum>) propertyType));

      IViewerObservableValue comboValue = ViewersObservables.observeSingleSelection(combo);
      observable = comboValue;
      Control control = combo.getControl();
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, comboValue, control);

      toolkit.adapt(control, true, true);
      widget = control;

    } else {
      Text text = toolkit.createText(parent, "");
      widget = text;
      // text.setToolTipText(tooltip);
      ISWTObservableValue textValue = Forms.observe(text);
      observable = textValue;
      Forms.bindPojoProperty(bindingContext, mmng, value, propertyName, isMandatory(value, propertyName), labelText, textValue, text);
    }
    widget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (observable != null && node != null) {
      observable.addChangeListener(new IChangeListener() {

        @Override
        public void handleChange(ChangeEvent event) {
          // lets notify the node that its changed
          String id = complexProperty.getId().toString();
View Full Code Here

    this.propertyDescriptor = null;
    super.dispose();
  }

  public Object getObserved() {
    IObservable decorated = getDecorated();
    if (decorated instanceof IObserving)
      return ((IObserving) decorated).getObserved();
    return null;
  }
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.