@Override
 public boolean dialogCanCloseOK() {
   if ("".equals(grammarNameField.getText().trim())) {
     XJAlert.display(getJavaComponent(), "Error", "Please enter a Grammar Name.");
     return false;
   }
   return true;
 }
 public void dialogWillCloseOK() {
   String text = getTestRigText();
   if (text.length() > Preferences.MAX_VALUE_LENGTH) {
     XJAlert.display(
         getJavaComponent(),
         "Error",
         "The test template text is too large: "
             + text.length()
             + " bytes but preferences can only hold "
             + Preferences.MAX_VALUE_LENGTH
             + " bytes. It will be truncated.");
     text = text.substring(0, Preferences.MAX_VALUE_LENGTH - 1);
   }
   setTestRigTemplateToFile(testRigFullPath, text);
   AWPrefs.setTestRigTemplateMode(grammarIdentifier, getTestRigMode());
   AWPrefs.setTestRigTemplateClass(grammarIdentifier, getTestRigClass());
 }