Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Kubitz2021-10-12 09:10:45 +0000
committerAndrey Loskutov2021-10-12 15:03:00 +0000
commit485d05449115e746767fb9516931c39249d5ecec (patch)
treeca772a289e8093e9c288d43226381ac901dd3db2
parent1f06e8394a6da27b10fcb818fb613fc835546228 (diff)
downloadeclipse.platform.debug-485d05449115e746767fb9516931c39249d5ecec.tar.gz
eclipse.platform.debug-485d05449115e746767fb9516931c39249d5ecec.tar.xz
eclipse.platform.debug-485d05449115e746767fb9516931c39249d5ecec.zip
Only proceed maximum 100 model changes of the Debug view in one batch and then give other UI tasks a chance to proceed in between. This should avoid long UI freezes while updating the JFace tree in case debuggee application generates many model changes that need to be processed in the Debug view Change-Id: I0a9ef6764e41f88ace3bae57ed40adaad9a8c368 Signed-off-by: Joerg Kubitz <jkubitz-eclipse@gmx.de> Reviewed-on: https://git.eclipse.org/r/c/platform/eclipse.platform.debug/+/186381 Tested-by: Platform Bot <platform-bot@eclipse.org> Reviewed-by: Andrey Loskutov <loskutov@gmx.de>
-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