mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DBE-9928 Collapse descendant nodes in the DB tree
GitOrigin-RevId: 2300e93346502e8ba87d4f5f87d025202a4238e6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4b225d15e6
commit
ca798996ea
@@ -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<TreePath> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<TreePath> 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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user