TreeUi: expand node when enqueued for update

This commit is contained in:
Kirill Kalishev
2009-10-26 14:52:08 +03:00
parent 9abc22b731
commit e07ea32dfd
3 changed files with 20 additions and 1 deletions
@@ -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);
}
}