From 530fa4355ca25481d2891e6dd9feca5013d05156 Mon Sep 17 00:00:00 2001 From: raghucssit Date: Mon, 9 Sep 2024 16:19:14 +0200 Subject: [PATCH] Improve 'Replace All' performance. For Large Java file 'Replace All' takes long time and freezes the UI. One of the reason is Projection Model tries to iterate over all the Projection Annotations to expand/collapse status. We can improve this situation by using Region specific iterator. This returns annotations which are enclosed by given offset. This improves the performance by 25% at least. See https://github.com/eclipse-platform/eclipse.platform.ui/issues/2257 --- .../jface/text/source/projection/ProjectionAnnotationModel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java b/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java index 422d2442b58..892d917d301 100644 --- a/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java +++ b/bundles/org.eclipse.jface.text/projection/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java @@ -149,7 +149,7 @@ protected boolean expandAll(int offset, int length, boolean fireModelChanged) { boolean expanding= false; - Iterator iterator= getAnnotationIterator(); + Iterator iterator= getAnnotationIterator(offset, length, true, true); while (iterator.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) iterator.next(); if (annotation.isCollapsed()) {