Package org.eclipse.core.internal.databinding.identity

Examples of org.eclipse.core.internal.databinding.identity.IdentityMap


   * @noreference This method is not intended to be referenced by clients.
   */
  protected Map doGetMap(Object source) {
    IObservableMap observable = observe(source);
    try {
      return new IdentityMap(observable);
    } finally {
      observable.dispose();
    }
  }
View Full Code Here


    return detailProperty.getValueType();
  }

  protected Map doGetMap(Object source) {
    Set set = masterProperty.getSet(source);
    Map map = new IdentityMap();
    for (Iterator it = set.iterator(); it.hasNext();) {
      Object key = it.next();
      map.put(key, detailProperty.getValue(key));
    }
    return map;
  }
View Full Code Here

    return detailProperty.getValueType();
  }

  protected Map doGetMap(Object source) {
    Map masterMap = masterProperty.getMap(source);
    Map detailMap = new IdentityMap();
    for (Iterator it = masterMap.entrySet().iterator(); it.hasNext();) {
      Map.Entry entry = (Map.Entry) it.next();
      detailMap.put(entry.getKey(), detailProperty.getValue(entry
          .getValue()));
    }
    return detailMap;
  }
View Full Code Here

    handleMasterMapChange(initMasterDiff);
  }

  private void handleMasterMapChange(MapDiff diff) {
    // Collect the detail values for the master values in the input diff.
    IdentityMap oldValues = new IdentityMap();
    IdentityMap newValues = new IdentityMap();

    // Handle added master values.
    Set addedKeys = diff.getAddedKeys();
    for (Iterator iter = addedKeys.iterator(); iter.hasNext();) {
      Object addedKey = iter.next();

      // 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

      this.elements = new IdentityObservableSet(realm, null);
    } finally {
      ObservableTracker.setIgnore(false);
    }

    this.delegateCaches = new IdentityMap();

    elements.addSetChangeListener(new ISetChangeListener() {
      public void handleSetChange(SetChangeEvent event) {
        for (Iterator it = event.diff.getRemovals().iterator(); it
            .hasNext();) {
View Full Code Here

        this.masterElementValues = delegate
            .observeDetail(masterElements);
      } finally {
        ObservableTracker.setIgnore(false);
      }
      this.cachedValues = new IdentityMap();

      masterElementValues.addMapChangeListener(this);
    }
View Full Code Here

                });
              }
            }
          });
    }
    cachedValues = new IdentityMap();
    staleKeys = new IdentitySet();
    super.firstListenerAdded();
  }
View Full Code Here

      knownMasterElements = new IdentityObservableSet(getRealm(), null);
    } finally {
      ObservableTracker.setIgnore(false);
    }

    cachedValues = new IdentityMap();
    staleElements = new IdentitySet();
    knownMasterElements.addSetChangeListener(new ISetChangeListener() {
      public void handleSetChange(SetChangeEvent event) {
        for (Iterator it = event.diff.getRemovals().iterator(); it
            .hasNext();) {
View Full Code Here

      knownMasterValues = new IdentityObservableSet(getRealm(), null);
    } finally {
      ObservableTracker.setIgnore(false);
    }

    cachedValues = new IdentityMap();
    staleMasterValues = new IdentitySet();
    knownMasterValues.addSetChangeListener(new ISetChangeListener() {
      public void handleSetChange(SetChangeEvent event) {
        for (Iterator it = event.diff.getRemovals().iterator(); it
            .hasNext();) {
View Full Code Here

TOP

Related Classes of org.eclipse.core.internal.databinding.identity.IdentityMap

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.