Package org.eclipse.core.databinding.observable.list

Examples of org.eclipse.core.databinding.observable.list.ListDiff


  public boolean retainAll(Collection c) {
    checkRealm();
    List list = new ArrayList(wrappedList);
    boolean changed = list.retainAll(c);
    if (changed) {
      ListDiff diff = Diffs.computeListDiff(wrappedList, list);
      wrappedList = list;
      updateTargetList(diff);
      fireListChange(diff);
    }
    return changed;
View Full Code Here


  }

  public Object set(int index, Object element) {
    checkRealm();
    Object oldElement = wrappedList.set(index, element);
    ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
        false, oldElement), Diffs.createListDiffEntry(index, true,
        element));
    updateTargetList(diff);
    fireListChange(diff);
    return oldElement;
View Full Code Here

      public void handleDispose(DisposeEvent event) {
        ListDetailValueObservableList.this.dispose();
      }
    });

    ListDiff initMasterDiff = Diffs.computeListDiff(Collections.EMPTY_LIST,
        masterList);
    handleMasterListChange(initMasterDiff);
  }
View Full Code Here

  public void updateModelToTarget() {
    final IObservableList modelList = (IObservableList) getModel();
    modelList.getRealm().exec(new Runnable() {
      public void run() {
        ListDiff diff = Diffs.computeListDiff(Collections.EMPTY_LIST,
            modelList);
        doUpdate(modelList, (IObservableList) getTarget(), diff,
            modelToTarget, true, true);
      }
    });
View Full Code Here

  public void updateTargetToModel() {
    final IObservableList targetList = (IObservableList) getTarget();
    targetList.getRealm().exec(new Runnable() {
      public void run() {
        ListDiff diff = Diffs.computeListDiff(Collections.EMPTY_LIST,
            targetList);
        doUpdate(targetList, (IObservableList) getModel(), diff,
            targetToModel, true, true);
      }
    });
View Full Code Here

   * @return the differences between oldList and newList
   */
  public static ListDiff computeListDiff(List oldList, List newList) {
    List diffEntries = new ArrayList();
    createListDiffs(new ArrayList(oldList), newList, diffEntries);
    ListDiff listDiff = createListDiff((ListDiffEntry[]) diffEntries
        .toArray(new ListDiffEntry[diffEntries.size()]));
    return listDiff;
  }
View Full Code Here

   *         the specified old and new list states.
   * @since 1.3
   */
  public static ListDiff computeLazyListDiff(final List oldList,
      final List newList) {
    return new ListDiff() {
      ListDiff lazyDiff;

      public ListDiffEntry[] getDifferences() {
        if (lazyDiff == null) {
          lazyDiff = Diffs.computeListDiff(oldList, newList);
View Full Code Here

  /**
   * @param differences
   * @return a list diff with the given entries
   */
  public static ListDiff createListDiff(final ListDiffEntry[] differences) {
    return new ListDiff() {
      public ListDiffEntry[] getDifferences() {
        return differences;
      }
    };
  }
View Full Code Here

  public boolean add(Object o) {
    checkRealm();

    List list = getList();

    ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(list
        .size(), true, o));
    updateList(list, diff);

    return true;
  }
View Full Code Here

    List list = getList();

    if (index < 0 || index > list.size())
      throw new IndexOutOfBoundsException();

    ListDiff diff = Diffs.createListDiff(Diffs.createListDiffEntry(index,
        true, o));
    updateList(list, diff);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.databinding.observable.list.ListDiff

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.