private boolean initPath(IResource selection) {
    if (!WebAppUtilities.isWebApp(hostPageProject)) {
      return false;
    }

    IFolder container = null;

    try {
      IFolder warFolder = WebAppUtilities.getWarSrc(hostPageProject);

      // If the selection was a subfolder of war, initialize to that
      if (selection.getType() == IResource.FOLDER) {
        if (warFolder.getFullPath().isPrefixOf(selection.getFullPath())) {
          container = (IFolder) selection;
          return true;
        }
      }

      // Otherwise, use the war folder as the default path
      if (warFolder.exists()) {
        container = warFolder;
        return true;
      }

      return false;

    } finally {
      if (container != null) {
        pathField.setText(container.getFullPath().removeFirstSegments(1).toString());
      }
    }
  }