diff --git a/bndtools.core/src/bndtools/Plugin.java b/bndtools.core/src/bndtools/Plugin.java index c2042a0bb9..d4fb57ab3b 100644 --- a/bndtools.core/src/bndtools/Plugin.java +++ b/bndtools.core/src/bndtools/Plugin.java @@ -70,7 +70,7 @@ public void start(BundleContext context) throws Exception { plugin = this; this.bundleContext = context; - scheduler = Executors.newScheduledThreadPool(1); + scheduler = Executors.newScheduledThreadPool(4); bndActivator = new Activator(); bndActivator.start(context); diff --git a/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java b/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java index eeb799fff2..22b1459791 100644 --- a/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java +++ b/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java @@ -336,9 +336,11 @@ private void updateTreeViewer() { if (!installed) { installed = true; installFilter(); + model.filterDirty.set(true); } - getTreeViewer().refresh(); + if (model.filterDirty.getAndSet(false)) + getTreeViewer().refresh(); } private void installFilter() { diff --git a/bndtools.core/src/bndtools/explorer/Model.java b/bndtools.core/src/bndtools/explorer/Model.java index 7174eb4439..155ac29f6b 100644 --- a/bndtools.core/src/bndtools/explorer/Model.java +++ b/bndtools.core/src/bndtools/explorer/Model.java @@ -24,6 +24,7 @@ class Model { String message = "initializing workspace"; int severity; String filterText; + final AtomicBoolean filterDirty = new AtomicBoolean(false); final List updates = new ArrayList<>(); final AtomicBoolean dirty = new AtomicBoolean(false); final Set pinned = new HashSet<>(); @@ -48,6 +49,7 @@ void setFilterText(String value) { glob = null; else glob = new Glob(value); + filterDirty.set(true); update(); } @@ -77,6 +79,7 @@ void updateMessage() { void setSeverity(int severity) { if (this.severity != severity) { this.severity = severity; + filterDirty.set(true); update(); } } @@ -84,7 +87,7 @@ void setSeverity(int severity) { private String getPrompt(Workspace ws) { try { if (prompt == null || prompt.isEmpty()) - prompt = "${basename;${workspace}} ${def;Bundle-Version} change macro def"; + prompt = "${basename;${workspace}} ${def;Bundle-Version} [?]"; else if ("-".equals(prompt)) return ""; @@ -113,16 +116,6 @@ void update() { * This runs async on the display thread. */ private void update0() { - try { - // coalesce some more updates on - // the worker thread(s). - Thread.sleep(50); - } catch (InterruptedException e) { - Thread.currentThread() - .interrupt(); - return; - } - if (dirty.getAndSet(false)) { updates.forEach(Runnable::run); } @@ -138,6 +131,7 @@ void doPin() { } else { pinned.add(p); } + filterDirty.set(true); update(); }