@RequiresBackgroundThread(generateAssertion = false)
  @Override
  protected PsiDirectory @NotNull [] getSelectedDirectories(Object @NotNull[] objects) {
    List<PsiDirectory> directories = new ArrayList<>();
    for (Object obj : objects) {
      PackageElementNode node = ObjectUtils.tryCast(obj, PackageElementNode.class);
      if (node != null) {
        PackageElement packageElement = node.getValue();
        PsiPackage aPackage = packageElement != null ? packageElement.getPackage() : null;
        final Module module = packageElement != null ? packageElement.getModule() : null;
        if (aPackage != null && module != null) {
          GlobalSearchScope scope = GlobalSearchScope.moduleScope(module);
          Collections.addAll(directories, aPackage.getDirectories(scope));
          if (Registry.is("projectView.choose.directory.on.compacted.middle.packages")) {
            Object parentValue = node.getParent().getValue();
            PsiPackage parentNodePackage = parentValue instanceof PackageElement ? ((PackageElement)parentValue).getPackage() : null;
            while (true) {
              aPackage = aPackage.getParentPackage();
              if (aPackage == null || aPackage.getQualifiedName().isEmpty() || aPackage.equals(parentNodePackage)) {
                break;
              }
              Collections.addAll(directories, aPackage.getDirectories(scope));
            }
          }
        }
      }
    }
    if (!directories.isEmpty()) {
      return directories.toArray(PsiDirectory.EMPTY_ARRAY);
    }
    return super.getSelectedDirectories(objects);
  }
@RequiresBackgroundThread(generateAssertion = false)
  @Override
  protected PsiDirectory @NotNull [] getSelectedDirectories(Object @NotNull[] objects)