diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewTree.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewTree.java index f2f11455570c..c5d24956cc7e 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewTree.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewTree.java @@ -28,7 +28,6 @@ import javax.swing.tree.TreeCellRenderer; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; import java.awt.*; -import java.util.ArrayDeque; /** * @author Konstantin Bulenkov @@ -162,22 +161,4 @@ public class ProjectViewTree extends DnDAwareTree { } return color; } - - @Override - public void collapsePath(TreePath path) { - int row = Registry.is("async.project.view.collapse.tree.path.recursively") ? getRowForPath(path) : -1; - if (row < 0) { - super.collapsePath(path); - } - else { - ArrayDeque deque = new ArrayDeque<>(); - deque.addFirst(path); - while (++row < getRowCount()) { - TreePath next = getPathForRow(row); - if (!path.isDescendant(next)) break; - if (isExpanded(next)) deque.addFirst(next); - } - deque.forEach(super::collapsePath); - } - } } diff --git a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java index e902a7a6163e..7b1f2b367646 100644 --- a/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java +++ b/platform/platform-api/src/com/intellij/ui/treeStructure/Tree.java @@ -30,6 +30,7 @@ import javax.swing.tree.*; import java.awt.*; import java.awt.dnd.Autoscroll; import java.awt.event.*; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Map; @@ -611,6 +612,24 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith return treeNode != null ? new TreePath(treeNode.getPath()) : new TreePath(node); } + @Override + public void collapsePath(TreePath path) { + int row = Registry.is("ide.tree.collapse.recursively") ? getRowForPath(path) : -1; + if (row < 0) { + super.collapsePath(path); + } + else { + ArrayDeque deque = new ArrayDeque<>(); + deque.addFirst(path); + while (++row < getRowCount()) { + TreePath next = getPathForRow(row); + if (!path.isDescendant(next)) break; + if (isExpanded(next)) deque.addFirst(next); + } + deque.forEach(super::collapsePath); + } + } + private static class MySelectionModel extends DefaultTreeSelectionModel { private TreePath[] myHeldSelection; diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index e06a743715de..85704cff0e30 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -148,6 +148,8 @@ ide.tree.expandRecursionDepth=50 ide.tree.checkStructure=false ide.tree.uiLockAttempt=250 ide.tree.deferred.icon.invalidates.cache=true +ide.tree.collapse.recursively=true +ide.tree.collapse.recursively.description=Temporary solution for IDEA-186081 to collapse all expanded nodes under the selected one. ide.tree.ui.cyclic.scrolling.allowed=false ide.tree.ui.cyclic.scrolling.allowed.description=Use Settings | Appearance & Behavior | Appearance | Cyclic scrolling in list @@ -292,9 +294,6 @@ allow.tree.structure.provider.in.dumb.mode.description=Do not filter out non-dum async.project.view.support.extra.select.disabled=false async.project.view.support.extra.select.disabled.description=Do not search and select by VirtualFile if search by PsiElement fails -async.project.view.collapse.tree.path.recursively=true -async.project.view.collapse.tree.path.recursively.description=Temporary solution for IDEA-186081 to collapse all expanded nodes under the selected one. - skip.untitled.windows.for.mac.messages=false skip.untitled.windows.for.mac.messages.description=Temporary key to test a fix for MacMessages