@Nullable
  private static PsiDirectory tryNotNullizeDirectory(@NotNull Project project, @Nullable PsiDirectory defaultTargetDirectory) {
    if (defaultTargetDirectory == null) {
      VirtualFile root = FileChooserUtil.getLastOpenedFile(project);
      if (root == null) root = project.isDefault() ? null : ProjectUtil.guessProjectDir(project);
      if (root == null) root = VfsUtil.getUserHomeDir();
      defaultTargetDirectory = root == null ? null :
                               root.isDirectory() ? PsiManager.getInstance(project).findDirectory(root) :
                               PsiManager.getInstance(project).findDirectory(root.getParent());

      if (defaultTargetDirectory == null) {
        LOG.warn("No directory found for project: " + project.getName() +", root: " + root);
      }
    }
    return defaultTargetDirectory;
  }
@Nullable
  private static PsiDirectory tryNotNullizeDirectory(@NotNull Project project, @Nullable PsiDirectory defaultTargetDirectory)