/**
   * Checks to see if the sketch has been modified, and if so, asks the user to save the sketch or
   * cancel the export. This prevents issues where an incomplete version of the sketch would be
   * exported, and is a fix for <A HREF="http://dev.processing.org/bugs/show_bug.cgi?id=157">Bug
   * 157</A>
   */
  protected boolean handleExportCheckModified() {
    if (sketch.isModified()) {
      Object[] options = {"OK", "Cancel"};
      int result =
          JOptionPane.showOptionDialog(
              this,
              "Save changes before export?",
              "Save",
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE,
              null,
              options,
              options[0]);

      if (result == JOptionPane.OK_OPTION) {
        handleSave(true);

      } else {
        // why it's not CANCEL_OPTION is beyond me (at least on the mac)
        // but f-- it.. let's get this s***e done..
        // } else if (result == JOptionPane.CANCEL_OPTION) {
        statusNotice("Export canceled, changes must first be saved.");
        // toolbar.clear();
        return false;
      }
    }
    return true;
  }