void (@NotNull Collection<? super AbstractTreeNode<?>> children, @NotNull PsiPackage aPackage, @Nullable Module module, @NotNull ViewSettings settings, final boolean inLibrary) { final boolean shouldSkipPackage = settings.isHideEmptyMiddlePackages() && isPackageEmpty(aPackage, module, !settings.isFlattenPackages(), inLibrary); final Project project = aPackage.getProject(); if (!shouldSkipPackage) { children.add(new PackageElementNode(project, new PackageElement(module, aPackage, inLibrary), settings)); } if (settings.isFlattenPackages() || shouldSkipPackage) { final PsiPackage[] subpackages = getSubpackages(aPackage, module, inLibrary); for (PsiPackage subpackage : subpackages) { addPackageAsChild(children, subpackage, module, settings, inLibrary); } } }