public void run() {
      String xml = txtXml.getText();
      java.io.ByteArrayInputStream inputStream = new ByteArrayInputStream(xml.getBytes());
      ClauseBase newClauseBase = new ClauseBase(tokenizer);
      try {
        newClauseBase.build(inputStream);
        clauseBase = newClauseBase;
        setXmlTextIsDirty(false);
      } catch (Exception ex) {
        ex.printStackTrace(System.out);
        JOptionPane.showMessageDialog(rootPane, Common.traceToString(ex));
      } finally {
        try {
          inputStream.close();
        } catch (IOException ex) {
        }
      }

      dlgWait.setVisible(false);
    }
  private void btnMatchActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnMatchActionPerformed

    if (!txtXml.isEditable()) {
      return;
    }

    ensureLatestClauseBase();

    results = clauseBase.match(txtInput.getText());

    if (results.isEmpty()) currentResult = -1;
    else currentResult = 0;

    refreshResultPane();
    displayResults();
  } // GEN-LAST:event_btnMatchActionPerformed
  private void btnMatchActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnMatchActionPerformed

    if (!txtXml.isEditable()) {
      return;
    }

    if (clauseBase == null || xmlTextIsDirty) {
      writeToClauseFile(txtXml.getText());
      setXmlTextIsDirty(false);
      ensureLatestClauseBase();
    }

    results = clauseBase.match(txtInput.getText());

    if (results.isEmpty()) {
      currentResult = -1;
    } else {
      currentResult = 0;
    }

    refreshResultPane();
    displayResults();
  } // GEN-LAST:event_btnMatchActionPerformed