@Override
  public Object @NotNull [] getChildElements(@NotNull Object element) {
    if (myRootElement == element) {
      if (myRootPsiElement == null) {
        return ArrayUtilRt.EMPTY_OBJECT_ARRAY;
      }
      if (!(myRootPsiElement instanceof PsiFile)) {
        return new Object[]{myRootPsiElement};
      }
      List<PsiFile> files = ((PsiFile)myRootPsiElement).getViewProvider().getAllFiles();
      return PsiUtilCore.toPsiFileArray(files);
    }
    return ApplicationManager.getApplication().runReadAction((Computable<Object[]>)() -> {
      if (myShowTreeNodes) {
        ArrayList<Object> list = new ArrayList<>();
        ASTNode root = element instanceof PsiElement? SourceTreeToPsiMap.psiElementToTree((PsiElement)element) :
                             element instanceof ASTNode? (ASTNode)element : null;
        if (element instanceof Inject) {
          root = SourceTreeToPsiMap.psiElementToTree(((Inject)element).getPsi());
        }

        if (root != null) {
          ASTNode child = root.getFirstChildNode();
          while (child != null) {
            if (myShowWhiteSpaces || child.getElementType() != TokenType.WHITE_SPACE) {
              PsiElement childElement = child.getPsi();
              list.add(childElement == null ? child : childElement);
            }
            child = child.getTreeNext();
          }
          PsiElement psi = root.getPsi();
          if (psi instanceof PsiLanguageInjectionHost) {
            InjectedLanguageManager.getInstance(myProject).enumerate(psi, (injectedPsi, places) -> list.add(new Inject(psi, injectedPsi)));
          }
        }
        return ArrayUtil.toObjectArray(list);
      }
      PsiElement[] elementChildren = ((PsiElement)element).getChildren();
      if (!myShowWhiteSpaces) {
        List<PsiElement> childrenList = new ArrayList<>(elementChildren.length);
        for (PsiElement psiElement : elementChildren) {
          if (psiElement instanceof PsiWhiteSpace) {
            continue;
          }
          childrenList.add(psiElement);
        }
        return PsiUtilCore.toPsiElementArray(childrenList);
      }
      return elementChildren;
    });
  }
@Override
  public Object @NotNull [] getChildElements(@NotNull Object element)