private static boolean isWritablePackage(@NotNull PsiPackage aPackage) {
    PsiDirectory[] directories = aPackage.getDirectories();
    for (PsiDirectory directory : directories) {
      if (directory.isValid() && directory.isWritable()) {
        return true;
      }
    }
    return false;
  }
private static boolean isWritablePackage(@NotNull PsiPackage aPackage)