public boolean validateNameAndPath(WizardContext context, boolean defaultFormat) throws ConfigurationException {
    String name = getNameValue();
    if (StringUtil.isEmptyOrSpaces(name)) {
      ApplicationNamesInfo info = ApplicationNamesInfo.getInstance();
      throw new ConfigurationException(JavaUiBundle.message("prompt.new.project.file.name", info.getFullProductName(), context.getPresentationName()));
    }

    String projectDirectoryPath = getPath();
    if (StringUtil.isEmptyOrSpaces(projectDirectoryPath)) {
      throw new ConfigurationException(JavaUiBundle.message("prompt.enter.project.file.location", context.getPresentationName()));
    }
    if (myShouldBeAbsolute && !new File(projectDirectoryPath).isAbsolute()) {
      throw new ConfigurationException(JavaUiBundle.message("file.location.should.be.absolute", StringUtil.capitalize(context.getPresentationName())));
    }

    boolean shouldPromptCreation = isPathChangedByUser();
    String message = JavaUiBundle.message("directory.project.file.directory", context.getPresentationName());
    if (!ProjectWizardUtil.createDirectoryIfNotExists(message, projectDirectoryPath, shouldPromptCreation)) {
      return false;
    }

    File projectDirectory = new File(projectDirectoryPath);
    if (projectDirectory.exists() && !projectDirectory.canWrite()) {
      throw new ConfigurationException(JavaUiBundle.message("project.directory.is.not.writable", projectDirectoryPath));
    }
    for (Project p : ProjectManager.getInstance().getOpenProjects()) {
      if (ProjectUtil.isSameProject(projectDirectory.toPath(), p)) {
        throw new ConfigurationException(JavaUiBundle.message("project.directory.is.already.taken", projectDirectoryPath, p.getName()));
      }
    }
    if (projectDirectory.exists() && !projectDirectory.isDirectory()) {
      LOG.warn(String.format("Project '%s' directory should be a directory", projectDirectoryPath));
    }
    boolean shouldContinue = true;
    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      String fileName = defaultFormat ? name + ProjectFileType.DOT_DEFAULT_EXTENSION : Project.DIRECTORY_STORE_FOLDER;
      File projectFile = new File(projectDirectory, fileName);
      if (projectFile.exists()) {
        message = CoreBundle.message("prompt.overwrite.project.file", projectFile.getAbsolutePath(), context.getPresentationName());
        shouldContinue = MessageDialogBuilder.yesNo(IdeBundle.message("title.file.already.exists"), message).show() == Messages.YES;
      }
    }
    return shouldContinue;
  }
public boolean validateNameAndPath(WizardContext context, boolean defaultFormat)