public static TreePath findAncestor(TreePath path, @NotNull Predicate<? super TreePath> predicate) {
    while (path != null) {
      if (predicate.test(path)) return path;
      path = path.getParentPath();
    }
    return null;
  }
public static TreePath findAncestor(TreePath path, @NotNull Predicate<? super TreePath> predicate)