private boolean visit(@NotNull JTree tree) {
    TreeModel model = tree.getModel();
    if (!(model instanceof TreeVisitor.Acceptor)) return false;

    var started = System.currentTimeMillis();
    expand(tree, promise -> expand(tree).onProcessed(expanded -> {
      if (LOG.isDebugEnabled() && expanded != null) {
        LOG.debug("Expanded " + expanded.size() + " paths in " + (System.currentTimeMillis() - started) + " ms");
      }
      if (tree instanceof @NotNull Tree jbTree) {
        jbTree.fireTreeStateRestoreFinished();
      }
      clearCachedPresentation(tree);
      if (isSelectionNeeded(expanded, tree, promise)) {
        select(tree).onProcessed(selected -> promise.setResult(null));
      }
    }));
    return true;
  }
private boolean visit(@NotNull JTree tree)