mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
scopes: restore tree selection under reloaded root if any (IDEA-73285 )
This commit is contained in:
@@ -402,6 +402,7 @@ public class ScopeTreeViewPanel extends JPanel implements Disposable {
|
||||
final DefaultTreeModel treeModel = (DefaultTreeModel)myTree.getModel();
|
||||
if (rootToReload != null && rootToReload != treeModel.getRoot()) {
|
||||
final List<TreePath> treePaths = TreeUtil.collectExpandedPaths(myTree, new TreePath(rootToReload.getPath()));
|
||||
final List<TreePath> selectionPaths = TreeUtil.collectSelectedPaths(myTree, new TreePath(rootToReload.getPath()));
|
||||
treeModel.reload(rootToReload);
|
||||
final TreePath path = new TreePath(rootToReload.getPath());
|
||||
final boolean wasCollapsed = myTree.isCollapsed(path);
|
||||
@@ -412,6 +413,9 @@ public class ScopeTreeViewPanel extends JPanel implements Disposable {
|
||||
for (TreePath treePath : treePaths) {
|
||||
myTree.expandPath(treePath);
|
||||
}
|
||||
for (TreePath selectionPath : selectionPaths) {
|
||||
TreeUtil.selectPath(myTree, selectionPath);
|
||||
}
|
||||
}
|
||||
TreeUtil.sort(rootToReload, getNodeComparator());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user