/**
* Disposes of this manager and all observables that it manages.
*/
public void dispose() {
Set observables = new IdentitySet();
observables.addAll(managedObservables);
for (Iterator it = contexts.keySet().iterator(); it.hasNext();) {
DataBindingContext context = (DataBindingContext) it.next();
Pair trackModelsOrTargets = (Pair) contexts.get(context);
boolean disposeTargets = ((Boolean) trackModelsOrTargets.a)
.booleanValue();
boolean disposeModels = ((Boolean) trackModelsOrTargets.b)
.booleanValue();
for (Iterator it2 = context.getBindings().iterator(); it2.hasNext();) {
Binding binding = (Binding) it2.next();
if (disposeTargets) {
observables.add(binding.getTarget());
}
if (disposeModels) {
observables.add(binding.getModel());
}
}
}
observables.removeAll(excludedObservables);
for (Iterator it = observables.iterator(); it.hasNext();) {
IObservable observable = (IObservable) it.next();
observable.dispose();
}
}