boolean (@NotNull JTree tree) { TreeModel model = tree.getModel(); if (!(model instanceof TreeVisitor.Acceptor)) return false; expand(tree, promise -> expand(tree).onProcessed(expanded -> { if (isSelectionNeeded(expanded, tree, promise)) { select(tree).onProcessed(selected -> promise.setResult(null)); } })); return true; }