@Override
  public @NotNull Collection<AbstractTreeNode<?>> modify(@NotNull AbstractTreeNode<?> parent, @NotNull Collection<AbstractTreeNode<?>> children, ViewSettings settings) {
    if (parent.getValue() instanceof Form) {
      return children;
    }

    // Optimization. Check if there are any forms at all.
    boolean formsFound = false;
    for (AbstractTreeNode<?> node : children) {
      if (node.getValue() instanceof PsiFile file) {
        if (file.getFileType() == GuiFormFileType.INSTANCE) {
          formsFound = true;
          break;
        }
      }
    }

    if (!formsFound) {
      return children;
    }

    Collection<AbstractTreeNode<?>> result = new LinkedHashSet<>(children);
    ProjectViewNode<?>[] copy = children.toArray(new ProjectViewNode[0]);
    for (ProjectViewNode<?> element : copy) {
      PsiClass psiClass = null;
      if (element.getValue() instanceof PsiClass) {
        psiClass = (PsiClass)element.getValue();
      }
      else if (element.getValue() instanceof PsiClassOwner) {
        final PsiClass[] psiClasses = ((PsiClassOwner) element.getValue()).getClasses();
        if (psiClasses.length == 1) {
          psiClass = psiClasses[0];
        }
      }
      if (psiClass == null) continue;
      String qName = psiClass.getQualifiedName();
      if (qName == null) continue;
      List<PsiFile> forms = FormClassIndex.findFormsBoundToClass(myProject, qName);
      Collection<BasePsiNode<? extends PsiElement>> formNodes = findFormsIn(children, forms);
      if (!formNodes.isEmpty()) {
        Collection<PsiFile> formFiles = convertToFiles(formNodes);
        Collection<BasePsiNode<? extends PsiElement>> subNodes = new ArrayList<>();
        subNodes.add((BasePsiNode<? extends PsiElement>) element);
        subNodes.addAll(formNodes);
        result.add(new FormNode(myProject, new Form(psiClass, formFiles), settings, subNodes));
        result.remove(element);
        result.removeAll(formNodes);
      }
    }
    return result;
  }
@Override
  public @NotNull Collection<AbstractTreeNode<?>> modify(@NotNull AbstractTreeNode<?> parent, @NotNull Collection<AbstractTreeNode<?>> children, ViewSettings settings)