private static @NotNull PsiDirectory createParentDirectories(@NotNull PsiDirectory directoryRoot, @NotNull String className) throws IncorrectOperationException {
    final PsiPackage currentPackage = JavaDirectoryService.getInstance().getPackage(directoryRoot);
    final String packagePrefix = currentPackage == null? null : currentPackage.getQualifiedName() + ".";
    final String packageName = extractPackage(packagePrefix != null && className.startsWith(packagePrefix)?
                                              className.substring(packagePrefix.length()) : className);
    final StringTokenizer tokenizer = new StringTokenizer(packageName, ".");
    while (tokenizer.hasMoreTokens()) {
      String packagePart = tokenizer.nextToken();
      PsiDirectory subdirectory = directoryRoot.findSubdirectory(packagePart);
      if (subdirectory == null) {
        directoryRoot.checkCreateSubdirectory(packagePart);
        subdirectory = directoryRoot.createSubdirectory(packagePart);
      }
      directoryRoot = subdirectory;
    }
    return directoryRoot;
  }
private static @NotNull PsiDirectory createParentDirectories(@NotNull PsiDirectory directoryRoot, @NotNull String className)