1 11 12 package org.eclipse.core.internal.databinding.observable; 13 14 import org.eclipse.core.databinding.observable.IStaleListener; 15 import org.eclipse.core.databinding.observable.StaleEvent; 16 import org.eclipse.core.databinding.observable.list.IListChangeListener; 17 import org.eclipse.core.databinding.observable.list.IObservableList; 18 import org.eclipse.core.databinding.observable.list.ListChangeEvent; 19 import org.eclipse.core.databinding.observable.list.ObservableList; 20 21 28 33 public class UnmodifiableObservableList extends ObservableList { 34 37 private final IObservableList wrappedList; 38 39 42 public UnmodifiableObservableList(IObservableList wrappedList) { 43 super(wrappedList.getRealm(), wrappedList, wrappedList.getElementType()); 44 this.wrappedList = wrappedList; 45 46 wrappedList.addListChangeListener(new IListChangeListener() { 47 public void handleListChange(ListChangeEvent event) { 48 fireListChange(event.diff); 50 } 51 }); 52 53 wrappedList.addStaleListener(new IStaleListener() { 54 public void handleStale(StaleEvent event) { 55 fireStale(); 56 } 57 }); 58 } 59 60 64 public void setStale(boolean stale) { 65 throw new UnsupportedOperationException (); 66 } 67 68 public boolean isStale() { 69 return wrappedList.isStale(); 70 } 71 } 72 | Popular Tags |