Do not collapse a single root node in Project View (IDEA-230663)

GitOrigin-RevId: 550e2f5efc637764401ec0cf43023f2dca2d6457
This commit is contained in:
Sergey Malenkov
2020-06-03 04:32:02 +03:00
committed by intellij-monorepo-bot
parent e23d3b2146
commit ac16f6050e
2 changed files with 11 additions and 2 deletions
@@ -959,7 +959,12 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
AnAction collapseAllAction = CommonActionsManager.getInstance().createCollapseAllAction(new DefaultTreeExpander(() -> {
AbstractProjectViewPane pane = getCurrentProjectViewPane();
return pane == null ? null : pane.myTree;
}), getComponent());
}) {
@Override
protected void collapseAll(@NotNull JTree tree, boolean strict, int keepSelectionLevel) {
super.collapseAll(tree, false, keepSelectionLevel);
}
}, getComponent());
collapseAllAction.getTemplatePresentation().setIcon(AllIcons.Actions.Collapseall);
titleActions.add(collapseAllAction);
}
@@ -34,7 +34,11 @@ open class DefaultTreeExpander(private val supplier: () -> JTree?) : TreeExpande
}
protected open fun collapseAll(tree: JTree, keepSelectionLevel: Int) {
TreeUtil.collapseAll(tree, keepSelectionLevel)
collapseAll(tree, true, keepSelectionLevel)
}
protected open fun collapseAll(tree: JTree, strict: Boolean, keepSelectionLevel: Int) {
TreeUtil.collapseAll(tree, strict, keepSelectionLevel)
showSelectionCentered(tree)
}