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
This commit is contained in:
Dmitry Drobotov
2024-12-09 13:43:08 +01:00
committed by intellij-monorepo-bot
parent 0adecf1134
commit 473efbed32

View File

@@ -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();
}
}
});
}