introduce reentrant bulkUpdate()

This commit is contained in:
Gregory.Shrago
2017-01-13 18:51:44 +03:00
parent 335e362386
commit 8056433e74
@@ -83,13 +83,19 @@ public abstract class SettingsEditor<Settings> implements Disposable {
}
public final void resetFrom(Settings s) {
myIsInUpdate = true;
bulkUpdate(() -> resetEditorFrom(s));
}
public final void bulkUpdate(Runnable runnable) {
boolean wasInUpdate = myIsInUpdate;
try {
resetEditorFrom(s);
myIsInUpdate = true;
runnable.run();
}
finally {
myIsInUpdate = false;
myIsInUpdate = wasInUpdate;
}
fireEditorStateChanged();
}
public final void applyTo(Settings s) throws ConfigurationException {