-// init(sceneGraph);
-
-// for(IElement e : diagram.getElements()) {
-// Node node = NodeUtils.
-// Variables.init(e, ProfileObserver.this);
-// }
-
- for(ProfileEntry e : entries) {
- if (DebugPolicy.DEBUG_PROFILE_OBSERVER_PERFORM)
- System.out.println("Apply profile entry: " + e);
- e.apply(ProfileObserver.this);
+ long t0 = DebugPolicy.DEBUG_PROFILE_OBSERVER_PERFORM ? System.nanoTime() : 0L;
+
+ if (updateAll) {
+ for(ProfileEntry e : entries) {
+ if (DebugPolicy.DEBUG_PROFILE_OBSERVER_PERFORM)
+ System.out.println("Apply profile entry: " + e);
+ e.apply(ProfileObserver.this);
+ }
+ updateAll = false;
+ // FIXME: Updates which were applied should be cleared to prevent double update.
+ // We can't, however, clear all updates since some nodes might still be missing.
+ //updates.clear();
+ } else {
+ List<Pair<Style, Object>> updatesCopy = new ArrayList<>(updates);
+ updates.clear();
+ for (Pair<Style, Object> update : updatesCopy) {
+ Style style = update.first;
+ Object item = update.second;
+
+ style.apply2(item, ProfileObserver.this);
+ }