Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
index 4ed94c55a..c00ae9ffe 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/model/TreeModelContentProvider.java
@@ -401,6 +401,9 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
private class DelayedDoModelChangedJob extends WorkbenchJob {
+ // limit batch size to avoid freezing the UI.
+ private static final int MAX_BATCH_SIZE = 100;
+
// queue of submitted deltas to process
private final List<Object> fQueue = new ArrayList<>();
private boolean shutdown;
@@ -418,8 +421,18 @@ public class TreeModelContentProvider implements ITreeModelContentProvider, ICon
if (shutdown || fQueue.isEmpty()) {
return Status.OK_STATUS;
}
- currentBatch = new ArrayList<>(fQueue);
- fQueue.clear();
+ fQueue.removeIf(o -> {
+ if (currentBatch.size() < MAX_BATCH_SIZE) {
+ currentBatch.add(o);
+ return true;
+ }
+ return false;
+ });
+ if (!fQueue.isEmpty()) {
+ // There is work left.
+ // Give other UI tasks chance to work instead of freezing UI
+ schedule();
+ }
}
if (DebugUIPlugin.DEBUG_CONTENT_PROVIDER) {
DebugUIPlugin.trace("Delayed batch size: " + currentBatch.size()); //$NON-NLS-1$

Back to the top