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

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


    }

    public void handleListChange(ListChangeEvent event) {
      ListDiffEntry[] diffs = event.diff.getDifferences();
      for (int i = 0; i < diffs.length; i++) {
        ListDiffEntry listDiffEntry = diffs[i];
        if (listDiffEntry.isAddition()) {
          Widget newChild = createWidget(listDiffEntry.getPosition());
          final UpdateRunnable updateRunnable = new UpdateRunnable(newChild, listDiffEntry
              .getElement());
          newChild.setData(updateRunnable);
          updateRunnable.updateIfNecessary();
        } else {
          theComposite.getChildren()[listDiffEntry.getPosition()]
              .dispose();
        }
      }
      theComposite.layout();
    }
View Full Code Here


    }

    public void handleListChange(ListChangeEvent event) {
      ListDiffEntry[] diffs = event.diff.getDifferences();
      for (int i = 0; i < diffs.length; i++) {
        ListDiffEntry listDiffEntry = diffs[i];
        if (listDiffEntry.isAddition()) {
          createChild(listDiffEntry.getElement(), listDiffEntry
              .getPosition());
        } else {
          disposeWidget(listDiffEntry.getPosition());
        }
      }
      theComposite.layout();
    }
View Full Code Here

    boolean hasListeners = hasListeners();
    ListDiffEntry[] masterEntries = masterListDiff.getDifferences();
    ListDiffEntry[] detailEntries = new ListDiffEntry[masterEntries.length];
    for (int i = 0; i < masterEntries.length; i++) {
      ListDiffEntry masterEntry = masterEntries[i];
      int index = masterEntry.getPosition();

      Object masterElement = masterEntry.getElement();
      Object detailValue;
      if (masterEntry.isAddition()) {
        detailValue = addDetailObservable(masterElement, index);
      } else {
        detailValue = removeDetailObservable(masterElement, index);
      }

      if (hasListeners) {
        // Create the corresponding diff for the detail list.
        detailEntries[i] = Diffs.createListDiffEntry(index,
            masterEntry.isAddition(), detailValue);
      }
    }

    if (hasListeners) {
      if (!wasStale && isStale()) {
View Full Code Here

   * @param element
   * @return a list diff entry
   */
  public static ListDiffEntry createListDiffEntry(final int position,
      final boolean isAddition, final Object element) {
    return new ListDiffEntry() {

      public int getPosition() {
        return position;
      }

View Full Code Here

   * @param element
   * @return a list diff entry
   */
  public static ListDiffEntry createListDiffEntry(final int position,
      final boolean isAddition, final Object element) {
    return new ListDiffEntry() {

      public int getPosition() {
        return position;
      }

View Full Code Here

              if (clearDestination) {
                destination.clear();
              }
              ListDiffEntry[] diffEntries = diff.getDifferences();
              for (int i = 0; i < diffEntries.length; i++) {
                ListDiffEntry listDiffEntry = diffEntries[i];
                if (listDiffEntry.isAddition()) {
                  IStatus setterStatus = updateListStrategy
                      .doAdd(
                          destination,
                          updateListStrategy
                              .convert(listDiffEntry
                                  .getElement()),
                          listDiffEntry.getPosition());

                  mergeStatus(multiStatus, setterStatus);
                  // TODO - at this point, the two lists
                  // will be out of sync if an error occurred...
                } else {
                  IStatus setterStatus = updateListStrategy
                      .doRemove(destination,
                          listDiffEntry.getPosition());
                 
                  mergeStatus(multiStatus, setterStatus);
                  // TODO - at this point, the two lists
                  // will be out of sync if an error occurred...
                }
View Full Code Here

TOP

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

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.