public static @NotNull PsiDirectory createPackageDirectoryInSourceRoot(@NotNull PackageWrapper aPackage, final @NotNull VirtualFile sourceRoot)
    throws IncorrectOperationException {
    PsiDirectory[] existing = aPackage.getDirectories(
      GlobalSearchScopes.directoryScope(aPackage.getManager().getProject(), sourceRoot, true));
    if (existing.length > 0) {
      return existing[0];
    }
    String qNameToCreate = qNameToCreateInSourceRoot(aPackage, sourceRoot);
    PsiDirectory current = aPackage.getManager().findDirectory(sourceRoot);
    LOG.assertTrue(current != null);
    if (qNameToCreate.isEmpty()) {
      return current;
    }
    final String[] shortNames = qNameToCreate.split("\\.");
    for (String shortName : shortNames) {
      PsiDirectory subdirectory = current.findSubdirectory(shortName);
      if (subdirectory == null) {
        subdirectory = current.createSubdirectory(shortName);
      }
      current = subdirectory;
    }
    return current;
  }
public static @NotNull PsiDirectory createPackageDirectoryInSourceRoot(@NotNull PackageWrapper aPackage, final @NotNull VirtualFile sourceRoot)