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 IJavaProject chooseProject() {
    IJavaProject[] projects;
    try {
      projects = JavaCore.create(Util.getWorkspaceRoot()).getJavaProjects();
    } catch (JavaModelException e) {
      JavaPlugin.log(e);
      projects = new IJavaProject[0];
    }

    // Filter the list to only show GWT projects
    List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>();
    for (IJavaProject project : projects) {
      if (GWTNature.isGWTProject(project.getProject())) {
        gwtProjects.add(project);
      }
    }

    // TODO: refactor this into utility function
    ILabelProvider labelProvider =
        new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
    dialog.setTitle("Project Selection");
    dialog.setMessage("Choose a project for the new HTML page");
    dialog.setElements(gwtProjects.toArray(new IJavaProject[0]));
    dialog.setInitialSelections(new Object[] {getJavaProject()});
    dialog.setHelpAvailable(false);
    if (dialog.open() == Window.OK) {
      return (IJavaProject) dialog.getFirstResult();
    }
    return null;
  }
  private boolean initProject(IResource selection) {
    IProject project = selection.getProject();
    if (project != null && GWTNature.isGWTProject(project)) {
      projectField.setText(project.getFullPath().makeRelative().toString());
      return true;
    }

    return false;
  }