コード例 #1
0
  private void updateEditorView() {
    editorPane.setText("");
    numParameters = 0;
    try {
      java.util.List elements = editableTemplate.getPrintfElements();
      for (Iterator it = elements.iterator(); it.hasNext(); ) {
        PrintfUtil.PrintfElement el = (PrintfUtil.PrintfElement) it.next();
        if (el.getFormat().equals(PrintfUtil.PrintfElement.FORMAT_NONE)) {
          appendText(el.getElement(), PLAIN_ATTR);
        } else {
          insertParameter(
              (ConfigParamDescr) paramKeys.get(el.getElement()),
              el.getFormat(),
              editorPane.getDocument().getLength());
        }
      }
    } catch (Exception ex) {
      JOptionPane.showMessageDialog(
          this,
          "Invalid Format: " + ex.getMessage(),
          "Invalid Printf Format",
          JOptionPane.ERROR_MESSAGE);

      selectedPane = 1;
      printfTabPane.setSelectedIndex(selectedPane);
      updatePane(selectedPane);
    }
  }
コード例 #2
0
 protected void setTemplate(PrintfTemplate template) {
   originalTemplate = template;
   editableTemplate.setFormat(template.m_format);
   editableTemplate.setTokens(template.m_tokens);
   updatePane(selectedPane);
 }
コード例 #3
0
 void printfTabPane_stateChanged(ChangeEvent e) {
   updateEditableTemplate(selectedPane);
   selectedPane = printfTabPane.getSelectedIndex();
   updatePane(selectedPane);
 }