@Override
  public @NotNull Collection<AbstractTreeNode<?>> getChildren() {
    if (getSettings().isShowModules()) {
      List<ModuleDescription> modulesWithSourceRoots = new ArrayList<>();
      for (Module module : ModuleManager.getInstance(getProject()).getModules()) {
        if (ModuleRootManager.getInstance(module).getSourceRoots().length > 0) {
          modulesWithSourceRoots.add(new LoadedModuleDescriptionImpl(module));
        }
      }
      return modulesAndGroups(modulesWithSourceRoots);
    }
    else {
      final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(myProject);
      final PsiManager psiManager = PsiManager.getInstance(myProject);
      final List<AbstractTreeNode<?>> children = new ArrayList<>();
      final Set<PsiPackage> topLevelPackages = new HashSet<>();

      for (final VirtualFile root : projectRootManager.getContentSourceRoots()) {
        final PsiDirectory directory = psiManager.findDirectory(root);
        if (directory == null) {
          continue;
        }
        final PsiPackage directoryPackage = JavaDirectoryService.getInstance().getPackage(directory);
        if (directoryPackage == null || PackageUtil.isPackageDefault(directoryPackage)) {
          // add subpackages
          final PsiDirectory[] subdirectories = directory.getSubdirectories();
          for (PsiDirectory subdirectory : subdirectories) {
            final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(subdirectory);
            if (aPackage != null && !PackageUtil.isPackageDefault(aPackage)) {
              topLevelPackages.add(aPackage);
            }
          }
          // add non-dir items
          children.addAll(ProjectViewDirectoryHelper.getInstance(myProject).getDirectoryChildren(directory, getSettings(), false));
        }
        else {
          // this is the case when a source root has pakage prefix assigned
          topLevelPackages.add(directoryPackage);
        }
      }

      var nodeBuilder = new PackageNodeBuilder(null, false);
      for (final PsiPackage psiPackage : topLevelPackages) {
        nodeBuilder.addPackageAsChild(children, psiPackage, getSettings());
      }

      if (getSettings().isShowLibraryContents()) {
        children.add(new PackageViewLibrariesNode(getProject(), null, getSettings()));
      }

      return children;
    }


  }
@Override
  public @NotNull Collection<AbstractTreeNode<?>> getChildren()