protected boolean isPackage(@NotNull Project project, @NotNull List<@NotNull PsiDirectory> directories) {
    final PsiDirectoryFactory factory = PsiDirectoryFactory.getInstance(project);
    for (PsiDirectory directory : directories) {
      if (factory.isPackage(directory)) {
        return true;
      }
    }
    return false;
  }
protected boolean isPackage(@NotNull Project project, @NotNull List<@NotNull PsiDirectory> directories)