Пример #1
0
  /**
   * Populate a SWT Combo with HTML doctypes
   *
   * @param c
   */
  public void populateHTMLCombo(Combo c) {

    for (HTML entry : HTML.values()) {
      c.add(entry.getDisplayString());
    }

    selectHTMLDocTypePreference(c);
  }
Пример #2
0
  /**
   * Return HTML to insert for selected html/xhtml doc type
   *
   * @param displayString
   * @return selected doc type or HTML.TRANSITIONAL_XHTML10
   */
  public HTML getHTMLForDisplayString(String displayString) {
    for (HTML entry : HTML.values()) {

      if (displayString.equals(entry.getDisplayString())) {
        return entry;
      }
    }

    return HTML.TRANSITIONAL_XHTML10;
  }
Пример #3
0
  /**
   * Pick the previous encoding preference else default to HTML.TRANSITIONAL_XHTML10
   *
   * @param c
   */
  public void selectHTMLDocTypePreference(Combo c) {
    String previousDocType = this.getDialogSettings().get(HTML_DOCTYPE_KEY);

    if (previousDocType != null && previousDocType.length() > 0) {
      int i = 0;
      for (HTML entry : HTML.values()) {
        if (previousDocType.equals(entry.getDisplayString())) {
          c.select(i);
          return;
        }
        i++;
      }
    }
    // default
    c.select(3);
  }