public static FileASTNode findFileElement(@NotNull ASTNode element) {
    ASTNode parent = element.getTreeParent();
    while (parent != null) {
      element = parent;
      parent = parent.getTreeParent();
    }

    if (CHECK_FOR_READ_ACTION && element instanceof TreeElement) {
      ((TreeElement)element).assertReadAccessAllowed();
    }

    if (element instanceof FileASTNode) {
      return (FileASTNode)element;
    }
    return null;
  }
public static FileASTNode findFileElement(@NotNull ASTNode element)