diff --git a/bndtools.core/src/bndtools/explorer/Model.java b/bndtools.core/src/bndtools/explorer/Model.java index b03489ca34..929c2fe105 100644 --- a/bndtools.core/src/bndtools/explorer/Model.java +++ b/bndtools.core/src/bndtools/explorer/Model.java @@ -102,12 +102,27 @@ void onUpdate(Runnable runnable) { } void update() { - dirty.set(true); + if (dirty.getAndSet(true)) + return; + Display.getDefault() .asyncExec(this::update0); } + /* + * This runs async on the display thread. + */ private void update0() { + try { + // coalesce some more updates on + // the worker thread(s). + Thread.sleep(10); + } catch (InterruptedException e) { + Thread.currentThread() + .interrupt(); + return; + } + if (dirty.getAndSet(false)) { updates.forEach(Runnable::run); }