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

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


    super.dispose();
  }

  private void removeElementChangeListener() {
    for (Iterator it = dependencies.iterator(); it.hasNext();) {
      IObservableValue observableValue = (IObservableValue) it.next();
      observableValue.removeChangeListener(markDirtyChangeListener);
    }
  }
View Full Code Here


    Object masterValue = masterProperty.getValue(source);
    detailProperty.updateMap(masterValue, diff);
  }

  public IObservableMap observe(Realm realm, Object source) {
    IObservableValue masterValue;

    ObservableTracker.setIgnore(true);
    try {
      masterValue = masterProperty.observe(realm, source);
    } finally {
View Full Code Here

    PropertyObservableUtil.cascadeDispose(detailMap, masterValue);
    return detailMap;
  }

  public IObservableMap observeDetail(IObservableValue master) {
    IObservableValue masterValue;

    ObservableTracker.setIgnore(true);
    try {
      masterValue = masterProperty.observeDetail(master);
    } finally {
View Full Code Here

      // For added master values, we set up a new detail observable.
      addDetailObservable(addedKey);

      // Get the value of the created detail observable for the new diff.
      IObservableValue detailValue = getDetailObservableValue(addedKey);
      newValues.put(addedKey, detailValue.getValue());
    }

    // Handle removed master values.
    Set removedKeys = diff.getRemovedKeys();
    for (Iterator iter = removedKeys.iterator(); iter.hasNext();) {
      Object removedKey = iter.next();

      // First of all, get the current detail value and add it to the set
      // of old values of the new diff.
      IObservableValue detailValue = getDetailObservableValue(removedKey);
      oldValues.put(removedKey, detailValue.getValue());

      // For removed master values, we dispose the detail observable.
      removeDetailObservable(removedKey);
    }

    // Handle changed master values.
    Set changedKeys = diff.getChangedKeys();
    for (Iterator iter = changedKeys.iterator(); iter.hasNext();) {
      Object changedKey = iter.next();

      // Get the detail value prior to the change and add it to the set of
      // old values of the new diff.
      IObservableValue oldDetailValue = getDetailObservableValue(changedKey);
      oldValues.put(changedKey, oldDetailValue.getValue());

      // Remove the old detail value for the old master value and add it
      // again for the new master value.
      removeDetailObservable(changedKey);
      addDetailObservable(changedKey);

      // Get the new detail value and add it to the set of new values.
      IObservableValue newDetailValue = getDetailObservableValue(changedKey);
      newValues.put(changedKey, newDetailValue.getValue());
    }

    // The different key sets are the same, only the values change.
    fireMapChange(Diffs.createMapDiff(addedKeys, removedKeys, changedKeys,
        oldValues, newValues));
View Full Code Here

  }

  private void addDetailObservable(final Object addedKey) {
    Object masterElement = masterMap.get(addedKey);

    IObservableValue detailValue = (IObservableValue) keyDetailMap
        .get(addedKey);

    if (detailValue == null) {
      detailValue = createDetailObservable(masterElement);

      keyDetailMap.put(addedKey, detailValue);

      detailValue.addValueChangeListener(new IValueChangeListener() {
        public void handleValueChange(ValueChangeEvent event) {
          if (!event.getObservableValue().isStale()) {
            staleDetailObservables.remove(event.getSource());
          }

          fireMapChange(Diffs.createMapDiffSingleChange(addedKey,
              event.diff.getOldValue(), event.diff.getNewValue()));
        }
      });

      if (detailValue.isStale()) {
        addStaleDetailObservable(detailValue);
      }
    }

    detailValue.addStaleListener(detailStaleListener);
  }
View Full Code Here

  private void removeDetailObservable(Object removedKey) {
    if (isDisposed()) {
      return;
    }

    IObservableValue detailValue = (IObservableValue) keyDetailMap
        .remove(removedKey);
    staleDetailObservables.remove(detailValue);
    detailValue.dispose();
  }
View Full Code Here

    if (!containsKey(key)) {
      return null;
    }

    IObservableValue detailValue = getDetailObservableValue(key);
    return detailValue.getValue();
  }
View Full Code Here

  public Object put(Object key, Object value) {
    if (!containsKey(key)) {
      return null;
    }

    IObservableValue detailValue = getDetailObservableValue(key);
    Object oldValue = detailValue.getValue();
    detailValue.setValue(value);
    return oldValue;
  }
View Full Code Here

    if (!containsKey(key)) {
      return null;
    }

    IObservableValue detailValue = getDetailObservableValue(key);
    Object oldValue = detailValue.getValue();

    masterMap.remove(key);

    return oldValue;
  }
View Full Code Here

    }

    if (keyDetailMap != null) {
      for (Iterator iter = keyDetailMap.values().iterator(); iter
          .hasNext();) {
        IObservableValue detailValue = (IObservableValue) iter.next();
        detailValue.dispose();
      }
      keyDetailMap.clear();
    }

    masterMap = null;
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.