private static RVersionSpec rVersionSpecFromString(String str) {
      if (str != null) {
        int loc = str.indexOf(SEP);
        if (loc != -1) {
          String version = str.substring(0, loc);
          String rHomeDir = str.substring(loc + SEP.length());
          if (version.length() > 0 && rHomeDir.length() > 0)
            return RVersionSpec.create(version, rHomeDir);
        }
      }

      // couldn't parse it
      return RVersionSpec.createEmpty();
    }
    private static String[] rVersionValues(JsArray<RVersionSpec> rVersions) {
      ArrayList<String> values = new ArrayList<String>();

      values.add(rVersionSpecToString(RVersionSpec.createEmpty()));

      for (int i = 0; i < rVersions.length(); i++)
        values.add(rVersionSpecToString(rVersions.get(i)));

      return values.toArray(new String[0]);
    }
    private static String[] rVersionChoices(JsArray<RVersionSpec> rVersions) {
      // do we need to disambiguate identical version numbers
      boolean disambiguate = RVersionSpec.hasDuplicates(rVersions);

      // build list of choices
      ArrayList<String> choices = new ArrayList<String>();

      // always include "default" lable
      choices.add(USE_DEFAULT_VERSION);

      for (int i = 0; i < rVersions.length(); i++) {
        RVersionSpec version = rVersions.get(i);
        String choice = "R version " + version.getVersion();
        if (disambiguate) choice = choice + " (" + version.getRHome() + ")";
        choices.add(choice);
      }

      return choices.toArray(new String[0]);
    }
 private static String rVersionSpecToString(RVersionSpec version) {
   if (version.getVersion().length() == 0) return "";
   else return version.getVersion() + SEP + version.getRHome();
 }
 public void setRVersion(RVersionSpec version) {
   if (!setValue(rVersionSpecToString(version)))
     setValue(rVersionSpecToString(RVersionSpec.createEmpty()));
 }
 private RVersionSpec getDefaultRVersion() {
   if (rServerRVersion_ != null) return rServerRVersion_.getRVersion();
   else return RVersionSpec.createEmpty();
 }