From c0596c7af4998885a26d09f6a68bf2fa425413f4 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 26 Apr 2018 13:30:32 +0300 Subject: [PATCH] old trees do not support promiseExpandAll --- .../com/intellij/util/ui/tree/TreeUtil.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java b/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java index 62af6317be27..e022226a7b77 100644 --- a/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java +++ b/platform/platform-api/src/com/intellij/util/ui/tree/TreeUtil.java @@ -784,7 +784,24 @@ public final class TreeUtil { } public static void expandAll(@NotNull JTree tree) { - promiseExpandAll(tree); + if (AbstractTreeBuilder.getBuilderFor(tree) != null) { + Object root = tree.getModel().getRoot(); + if (root == null) return; + tree.expandPath(new TreePath(root)); + int oldRowCount = 0; + do { + int rowCount = tree.getRowCount(); + if (rowCount == oldRowCount) break; + oldRowCount = rowCount; + for (int i = 0; i < rowCount; i++) { + tree.expandRow(i); + } + } + while (true); + } + else { + promiseExpandAll(tree); + } } /**