private void quit()
    {
        List<SpecificationDocument> allSpecifications = allSpecifications();
        boolean hasEditedDocuments = hasEditedDocuments(allSpecifications);
        String applicationQuitTextKey = hasEditedDocuments ? "application.quit.edited.message" : "application.quit.message";
        int dialogOption = hasEditedDocuments ? JOptionPane.YES_NO_CANCEL_OPTION : JOptionPane.YES_NO_OPTION;

        int result = JOptionPane.showConfirmDialog(this,
                                                   uiBundle.getString(applicationQuitTextKey),
                                                   uiBundle.getString("application.quit.title"),
                                                   dialogOption);

        // if there are no edited documents and the user wants to quite, don't check, close
        // if there are no edited documents and the user doesn't want to quit, don't check, don't close
        // if there are edited documents and the user doesn't want to quit, don't check, don't close
        // if there are edited documents and the user wants to quit without saving, don't check, close
        // if there are edited documents and the user wants to quit with saving, check, close
        boolean shouldCheck = (hasEditedDocuments && (result == JOptionPane.YES_OPTION));
        boolean shouldClose = ((result == JOptionPane.YES_OPTION)
                                      || (hasEditedDocuments && (result == JOptionPane.NO_OPTION)));

        // close the application, checking unsaved specifications if needed
        // if the number of closed specifications does not match the number of
        // actually closed specifications, don't quit because the user cancelled
        if (shouldClose)
            {
            int closedSpecifications = closeSpecifications(allSpecifications, shouldCheck);
            if (closedSpecifications == allSpecifications.size())
                {
                System.exit(0);
                }
            }

    }