private IStatus validateProject() {
    hostPageProject = null;

    String str = projectField.getText().trim();
    if (str.length() == 0) {
      return Util.newErrorStatus("Enter the project name");
    }

    IPath path = new Path(str);
    if (path.segmentCount() != 1) {
      return Util.newErrorStatus("Invalid project path");
    }

    IProject project = Util.getWorkspaceRoot().getProject(str);
    if (!project.exists()) {
      return Util.newErrorStatus("Project does not exist");
    }

    if (!project.isOpen()) {
      return Util.newErrorStatus("Project is not open");
    }

    if (!GWTNature.isGWTProject(project)) {
      return Util.newErrorStatus("Project is not a GWT project");
    }

    hostPageProject = project;
    return Status.OK_STATUS;
  }
  private IStatus validateFileName() {
    fileName = null;

    String str = fileNameField.getText().trim();
    if (str.length() == 0) {
      return Util.newErrorStatus("Enter a file name");
    }

    // Validate the file name
    IStatus nameStatus = ResourcesPlugin.getWorkspace().validateName(str, IResource.FILE);
    if (nameStatus.matches(IStatus.ERROR)) {
      return Util.newErrorStatus("Invalid file name. {0}", nameStatus.getMessage());
    }

    // Make sure the host page doesn't already exist in the public path
    if (hostPagePath != null) {
      IPath htmlFilePath =
          hostPagePath
              .append(str)
              .removeFileExtension()
              .addFileExtension(((AbstractNewFileWizard) getWizard()).getFileExtension());
      IFile htmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(htmlFilePath);
      if (htmlFile.exists()) {
        return Util.newErrorStatus("''{0}'' already exists", htmlFilePath.toString());
      }
    }

    fileName = str;
    return Status.OK_STATUS;
  }
  private IStatus validatePath() {
    hostPagePath = null;

    pathField.enableButton(hostPageProject != null);

    String str = pathField.getText().trim();
    if (str.length() == 0) {
      return Util.newErrorStatus("Enter the file path");
    }

    if (hostPageProject == null) {
      // The rest of the path validation relies on having a valid project, so if
      // we don't have one, bail out here with an OK (the project's error will
      // supercede this one).
      return Status.OK_STATUS;
    }

    IPath path = new Path(hostPageProject.getName()).append(str).makeAbsolute();
    IStatus pathStatus =
        ResourcesPlugin.getWorkspace().validatePath(path.toString(), IResource.FOLDER);
    if (pathStatus.matches(IStatus.ERROR)) {
      return Util.newErrorStatus("Invalid path. {0}", pathStatus.getMessage());
    }

    // Path is valid
    hostPagePath = path;

    IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
    if (!folder.exists()) {
      return Util.newWarningStatus(
          MessageFormat.format(
              "The path ''{0}'' does not exist.  It will be created when you click Finish.",
              path.toString()));
    }

    return Status.OK_STATUS;
  }