/** Form validation method. */
    @SuppressWarnings("rawtypes")
    public FormValidation doCheckSourceProject(
        @AncestorInPath AccessControlled subject, @QueryParameter String value) {
      // Require CONFIGURE permission on this project
      if (!subject.hasPermission(Item.CONFIGURE)) return FormValidation.ok();

      if (value == null) return FormValidation.ok();

      value = value.trim();

      if (value.equals("")) {
        return FormValidation.error("This field is required");
      }

      Item item = Hudson.getInstance().getItem(value);
      if (item == null)
        return FormValidation.error(
            "No such project '"
                + value
                + "'. Did you mean '"
                + AbstractProject.findNearest(value).getName()
                + "' ?");
      if (item instanceof Job && (((AbstractProject) item).getScm() instanceof GitSCM)) {
        return FormValidation.ok();
      }

      return FormValidation.error("'" + value + "' is not a Git project");
    }
    public FormValidation doCheck(
        @AncestorInPath AbstractProject project, @QueryParameter String value) {
      // Require CONFIGURE permission on this project
      if (!project.hasPermission(Item.CONFIGURE)) return FormValidation.ok();

      for (String name : Util.tokenize(fixNull(value), ",")) {
        name = name.trim();
        if (Jenkins.getInstance().getItem(name, project) == null)
          return FormValidation.error(
              hudson.tasks.Messages.BuildTrigger_NoSuchProject(
                  name, AbstractProject.findNearest(name).getName()));
      }

      return FormValidation.ok();
    }