Class EObjectChangeNotifier
java.lang.Object
com.amalgamasimulation.desktop.ui.emf.EObjectChangeNotifier
Observes every change in the containment tree of a root
EObject with a single
EContentAdapter and notifies listeners once per batch of changes.
A batch ends when no change has arrived for the quiet period, so a burst of changes (moving many objects, removing many objects, a long operation applied in one go) results in one call of each affected listener. Changes are accepted from any thread; listeners are always called on the UI thread.
Typed listeners are called when the batch touches an object of one of the given classes (subclasses included): the changed object, objects added to or removed from its containment features, or the containers of the changed object. References are not traversed.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChangeListener(Runnable changeHandler) Adds a handler called once per batch of any changes.voidaddChangeListener(Set<Class<?>> types, Runnable changeHandler) Adds a handler called once per batch that touches an object of any of the given classes or their subclasses.voidaddFeatureChangeListener(Set<org.eclipse.emf.ecore.EStructuralFeature> features, Runnable changeHandler) voidobserveEObject(org.eclipse.emf.ecore.EObject newRoot) Starts observing the given root and stops observing the previous one.voidremoveChangeListener(Runnable changeHandler) Removes the handler added by any of theaddChangeListenermethods.
-
Field Details
-
DEFAULT_QUIET_PERIOD_MS
public static final int DEFAULT_QUIET_PERIOD_MS- See Also:
-
-
Constructor Details
-
EObjectChangeNotifier
public EObjectChangeNotifier()
-
-
Method Details
-
observeEObject
public void observeEObject(org.eclipse.emf.ecore.EObject newRoot) Starts observing the given root and stops observing the previous one. Passnullto stop observing.Replacing the root counts as a change of every object: all listeners, typed ones included, are called after the quiet period, as for any other batch.
-
addChangeListener
Adds a handler called once per batch that touches an object of any of the given classes or their subclasses. -
addFeatureChangeListener
-
addChangeListener
Adds a handler called once per batch of any changes. -
removeChangeListener
Removes the handler added by any of theaddChangeListenermethods.
-