Package org.eclipse.core.databinding.observable.set

Examples of org.eclipse.core.databinding.observable.set.SetDiff


   
    /**
     * Called when the child set changes. Should not be called directly by the viewer.
     */
    public void handleSetChange(SetChangeEvent event) {
        SetDiff diff = event.diff;
        TreeViewer viewer = this.contentProvider.getViewer();
        if (viewer != null) {
            Control control = viewer.getControl();
            if (control != null) {
                if (control.isDisposed()) {
                    // If the widgetry was disposed without notifying the content provider, then
                    // dispose the content provider now and stop processing events.
                    contentProvider.dispose();
                    return;
                }
            }
        }
       
        boolean shouldHavePendingNode = children.isEmpty() && children.isStale();
       
        Set additions = diff.getAdditions();
        // Check if we should add the pending node
        if (shouldHavePendingNode && !hasPendingNode) {
            HashSet newAdditions = new HashSet();
            newAdditions.addAll(additions);
            newAdditions.add(contentProvider.getPendingNode());
            additions = newAdditions;
            hasPendingNode = true;
        }

        Set removals = diff.getRemovals();
        // Check if we should remove the pending node
        if (!shouldHavePendingNode && hasPendingNode) {
            HashSet newRemovals = new HashSet();
            newRemovals.addAll(removals);
            newRemovals.add(contentProvider.getPendingNode());
View Full Code Here


   * @noreference This method is not intended to be referenced by clients.
   */
  protected abstract void doSetSet(Object source, Set set, SetDiff diff);

  protected void doSetSet(Object source, Set set) {
    SetDiff diff = Diffs.computeLazySetDiff(doGetSet(source), set);
    doSetSet(source, set, diff);
  }
View Full Code Here

    validationStatus.addValueChangeListener(validationStatusChangeListener);
  }

  private void updateWrappedSet(Set newSet) {
    Set oldSet = wrappedSet;
    SetDiff diff = Diffs.computeSetDiff(oldSet, newSet);
    wrappedSet = newSet;
    fireSetChange(diff);
  }
View Full Code Here

  public boolean add(Object o) {
    getterCalled();
    boolean changed = wrappedSet.add(o);
    if (changed) {
      SetDiff diff = Diffs.createSetDiff(Collections.singleton(o),
          Collections.EMPTY_SET);
      updateTargetSet(diff);
      fireSetChange(diff);
    }
    return changed;
View Full Code Here

  public boolean addAll(Collection c) {
    getterCalled();
    HashSet set = new HashSet(wrappedSet);
    boolean changed = set.addAll(c);
    if (changed) {
      SetDiff diff = Diffs.computeSetDiff(wrappedSet, set);
      wrappedSet = set;
      updateTargetSet(diff);
      fireSetChange(diff);
    }
    return changed;
View Full Code Here

  public void clear() {
    getterCalled();
    if (isEmpty())
      return;
    SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET, wrappedSet);
    wrappedSet = new HashSet();
    updateTargetSet(diff);
    fireSetChange(diff);
  }
View Full Code Here

        return last = wrappedIterator.next();
      }

      public void remove() {
        wrappedIterator.remove();
        SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET,
            Collections.singleton(last));
        updateTargetSet(diff);
        fireSetChange(diff);
      }
    };
View Full Code Here

  public boolean remove(Object o) {
    getterCalled();
    boolean changed = wrappedSet.remove(o);
    if (changed) {
      SetDiff diff = Diffs.createSetDiff(Collections.EMPTY_SET,
          Collections.singleton(o));
      updateTargetSet(diff);
      fireSetChange(diff);
    }
    return changed;
View Full Code Here

  public boolean removeAll(Collection c) {
    getterCalled();
    Set set = new HashSet(wrappedSet);
    boolean changed = set.removeAll(c);
    if (changed) {
      SetDiff diff = Diffs.computeSetDiff(wrappedSet, set);
      wrappedSet = set;
      updateTargetSet(diff);
      fireSetChange(diff);
    }
    return changed;
View Full Code Here

  public boolean retainAll(Collection c) {
    getterCalled();
    Set set = new HashSet(wrappedSet);
    boolean changed = set.retainAll(c);
    if (changed) {
      SetDiff diff = Diffs.computeSetDiff(wrappedSet, set);
      wrappedSet = set;
      updateTargetSet(diff);
      fireSetChange(diff);
    }
    return changed;
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.observable.set.SetDiff

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.