diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java index 29a65da83d73..b606a2aa09be 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java @@ -912,7 +912,7 @@ public class AbstractTreeUi { @Override public void run(final Boolean changes) { if (changes) { - invokeLaterIfNeeded(true, new Runnable() { + invokeLaterIfNeeded(false, new Runnable() { @Override public void run() { Object element = nodeDescriptor.getElement(); @@ -3515,18 +3515,22 @@ public class AbstractTreeUi { } private void updateNodeImageAndPosition(@NotNull final DefaultMutableTreeNode node, boolean updatePosition, boolean nodeChanged) { - ApplicationManager.getApplication().assertIsDispatchThread(); if (!(node.getUserObject() instanceof NodeDescriptor)) return; NodeDescriptor descriptor = getDescriptorFrom(node); if (getElementFromDescriptor(descriptor) == null) return; if (updatePosition) { DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode)node.getParent(); - if (parentNode != null) { + if (parentNode == null) { + nodeChanged(node); + } + else { + ApplicationManager.getApplication().assertIsDispatchThread(); + int oldIndex = parentNode.getIndex(node); int newIndex = oldIndex; if (isLoadingChildrenFor(node.getParent()) || getBuilder().isChildrenResortingNeeded(descriptor)) { - final List children = new ArrayList(parentNode.getChildCount()); + List children = new ArrayList(parentNode.getChildCount()); for (int i = 0; i < parentNode.getChildCount(); i++) { TreeNode child = parentNode.getChildAt(i); LOG.assertTrue(child != null); @@ -3548,10 +3552,8 @@ public class AbstractTreeUi { nodeChanged(node); } } - else { - nodeChanged(node); - } - } else if (nodeChanged) { + } + else if (nodeChanged) { nodeChanged(node); } }