Package org.eclipse.core.databinding
Class ObservablesManager
java.lang.Object
org.eclipse.core.databinding.ObservablesManager
An observables manager can be used for lifecycle management of
IObservable objects.- Since:
- 1.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddContext(DataBindingContext context, boolean trackTargets, boolean trackModels) Adds the databinding context to be disposed by this manager.voidaddObservable(IObservable observable) Adds the given observable to this manager.voidaddObservablesFromContext(DataBindingContext context, boolean trackTargets, boolean trackModels) Adds the given data binding context's target and/or model observables to be disposed by this manager.voiddispose()Disposes of this manager and all observables that it manages.voidexcludeObservable(IObservable observable) Adds the given observable to this manager's exclusion list.voidrunAndCollect(Runnable runnable) Deprecated.This method is very error prone.
-
Constructor Details
-
ObservablesManager
public ObservablesManager()Create a new observables manager.
-
-
Method Details
-
addObservable
Adds the given observable to this manager.- Parameters:
observable- the observable
-
excludeObservable
Adds the given observable to this manager's exclusion list. The given observable will not be disposed of by this manager.- Parameters:
observable- the observable
-
addObservablesFromContext
public void addObservablesFromContext(DataBindingContext context, boolean trackTargets, boolean trackModels) Adds the given data binding context's target and/or model observables to be disposed by this manager.Prefer the
addContext(org.eclipse.core.databinding.DataBindingContext, boolean, boolean)method if thecontextargument should also be disposed.Note: The
contextargument must NOT be disposed before this manager itself is disposed. If it is then its contents will not be disposed by this manager.- Parameters:
context- the data binding contexttrackTargets-trueif the target observables of the context should be managedtrackModels-trueif the model observables of the context should be managed
-
addContext
Adds the databinding context to be disposed by this manager. Identical toaddObservablesFromContext(org.eclipse.core.databinding.DataBindingContext, boolean, boolean)except that the binding context itself is also disposed.Note: The
contextargument must NOT be disposed before this manager itself is disposed. (There is no reason to disposecontextmanually when using this method.)- Parameters:
context- the data binding context to addtrackTargets-trueif the target observables of the context should be managedtrackModels-trueif the model observables of the context should be managed- Since:
- 1.10
-
runAndCollect
Deprecated.This method is very error prone. If any class creates internal observables without hiding them withObservableTracker.setIgnore(boolean)the result can be that objects are disposed involuntary or in the wrong order. Prefer instead to useaddContext(org.eclipse.core.databinding.DataBindingContext, boolean, boolean).Executes the specified runnable and adds to this manager all observables created while executing the runnable.- Parameters:
runnable- the runnable to execute- Since:
- 1.2
-
dispose
public void dispose()Disposes of this manager and all observables that it manages.Note: If
addObservablesFromContext(org.eclipse.core.databinding.DataBindingContext, boolean, boolean)is used then itscontextargument must NOT be disposed before this object itself is disposed. If it is then its contents will not be disposed by this object.
-