From 473efbed32f490d50600e4f26c171834b84ffd63 Mon Sep 17 00:00:00 2001 From: Dmitry Drobotov Date: Mon, 9 Dec 2024 13:43:08 +0100 Subject: [PATCH] IJPL-172840 Use Tree's suspend expand/collapse accessibility announcements API in the Structure tree This fixes a crash when opening the File Structure popup in very large files (JBR-7655) (cherry picked from commit 9f497ecbf584fe8596630ab86245a0835a6eb3f4) IJ-CR-151182 GitOrigin-RevId: 243ba2314b173347983aeea2299efdede60b2baa --- .../newStructureView/StructureViewComponent.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java index 3ccf34ea77c8..b60059b7debd 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java @@ -1162,7 +1162,17 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre void expandLater(@NotNull TreePath parentPath, @NotNull Object o) { ApplicationManager.getApplication().invokeLater(() -> { if (!tree.isVisible(parentPath) || !tree.isExpanded(parentPath)) return; - tree.expandPath(parentPath.pathByAddingChild(o)); + try { + if (tree instanceof Tree jbTree) { + jbTree.suspendExpandCollapseAccessibilityAnnouncements(); + } + tree.expandPath(parentPath.pathByAddingChild(o)); + } + finally { + if (tree instanceof Tree jbTree) { + jbTree.resumeExpandCollapseAccessibilityAnnouncements(); + } + } }); }