boolean (@Nullable DefaultMutableTreeNode actionNode) { if (isProcessingNow() || !myCanRunRestore || myUi.hasNodesToUpdate()) { return false; } invalidateToSelectWithRefsToParent(actionNode); setProcessingNow(true); final Object[] toSelect = getToSelect(); final Object[] toExpand = getToExpand(); final Map<Object, Condition> adjusted = new WeakHashMap<>(myAdjustedSelection); clearSelection(); clearExpansion(); final Set<Object> originallySelected = myUi.getSelectedElements(); myUi._select(toSelect, new TreeRunnable("UpdaterTreeState.restore") { @Override public void perform() { processUnsuccessfulSelections(toSelect, o -> { if (myUi.getTree().isRootVisible() || !myUi.getTreeStructure().getRootElement().equals(o)) { addSelection(o); } return o; }, originallySelected); processAdjusted(adjusted, originallySelected).doWhenDone(new TreeRunnable("UpdaterTreeState.restore: on done") { @Override public void perform() { myUi.expand(toExpand, new TreeRunnable("UpdaterTreeState.restore: after on done") { @Override public void perform() { myUi.clearUpdaterState(); setProcessingNow(false); } }, true); } }); } }); return true; }