Ejemplo n.º 1
0
  /** Format a date to GMT */
  public static String formatDate(Date date, GruntspudContext context) {
    DateFormat format =
        new SimpleDateFormat(
            StringListModel.getSelectedItemForStringListPropertyString(
                context
                    .getHost()
                    .getProperty(
                        Constants.OPTIONS_DISPLAY_DATE_FORMAT,
                        "&" + Constants.DEFAULT_DATE_FORMAT)));
    format.setTimeZone(TimeZone.getTimeZone("GMT+0000"));

    return format.format(date);
  }
Ejemplo n.º 2
0
  /**
   * Gets the selectedGlobalCVSRoot attribute of the GruntspudUtil class
   *
   * @param host Description of the Parameter
   * @return The selectedGlobalCVSRoot value
   */
  public static CVSRoot getSelectedGlobalCVSRoot(GruntspudContext context) {
    StringTokenizer s =
        new StringTokenizer(
            context.getHost().getProperty(Constants.OPTIONS_CONNECTION_ROOT_LIST, "|"), "");

    while (s.hasMoreTokens()) {
      boolean sel = false;
      String t = s.nextToken();

      if (t.startsWith("&")) {
        t = t.substring(1);
        sel = true;
      }

      if (sel) {
        try {
          return new CVSRoot(t);
        } catch (IllegalArgumentException iae) {
        }
      }
    }

    return null;
  }