mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
TreeUi: expand node when enqueued for update
This commit is contained in:
@@ -2956,7 +2956,9 @@ public class AbstractTreeUi {
|
||||
|
||||
|
||||
if (myTree.isExpanded(getPathFor(toExpand)) && !myUnbuiltNodes.contains(toExpand)) {
|
||||
processNodeActionsIfReady(toExpand);
|
||||
if (!areChildrenToBeUpdated(toExpand)) {
|
||||
processNodeActionsIfReady(toExpand);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!myUnbuiltNodes.contains(toExpand)) {
|
||||
@@ -2968,6 +2970,9 @@ public class AbstractTreeUi {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean areChildrenToBeUpdated(DefaultMutableTreeNode node) {
|
||||
return getUpdater().isEnqueuedToUpdate(node) || isUpdatingParent(node);
|
||||
}
|
||||
|
||||
private String asString(DefaultMutableTreeNode node) {
|
||||
if (node == null) return null;
|
||||
|
||||
@@ -316,4 +316,13 @@ public class AbstractTreeUpdater implements Disposable, Activatable {
|
||||
public void flush() {
|
||||
myUpdateQueue.sendFlush();
|
||||
}
|
||||
|
||||
public boolean isEnqueuedToUpdate(DefaultMutableTreeNode node) {
|
||||
Iterator<TreeUpdatePass> nodes = myNodeQueue.iterator();
|
||||
while (nodes.hasNext()) {
|
||||
TreeUpdatePass each = nodes.next();
|
||||
if (each.willUpdate(node)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,4 +79,9 @@ public class TreeUpdatePass {
|
||||
public String toString() {
|
||||
return "TreUpdatePass node=" + myNode + " stamp=" + myUpdateStamp + " expired=" + myExpired + " currentNode=" + myCurrentNode + " allocation=" + myAllocation;
|
||||
}
|
||||
|
||||
public boolean willUpdate(@NotNull DefaultMutableTreeNode node) {
|
||||
@NotNull DefaultMutableTreeNode currentNode = myCurrentNode != null ? myCurrentNode : myNode;
|
||||
return node.isNodeAncestor(currentNode);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user