+
+ hdesktop.setQuitHandler(new QuitHandler()
+ {
+ @Override
+ public void handleQuitRequestWith(QuitEvent e, QuitResponse r)
+ {
+ boolean confirmQuit = jalview.bin.Cache
+ .getDefault(CONFIRM_KEYBOARD_QUIT, true);
+ int n;
+ if (confirmQuit)
+ {
+ n = JOptionPane.showConfirmDialog(null,
+ MessageManager.getString("label.quit_jalview"),
+ MessageManager.getString("action.quit"),
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.PLAIN_MESSAGE, null);
+ }
+ else
+ {
+ n = JOptionPane.OK_OPTION;
+ }
+ if (n == JOptionPane.OK_OPTION)
+ {
+ System.out.println("Shortcut Quit confirmed by user");
+ quit();
+ r.performQuit(); // probably won't reach this line, but just in
+ // case
+ }
+ else
+ {
+ r.cancelQuit();
+ System.out.println("Shortcut Quit cancelled by user");
+ }
+ }
+ });
+ hdesktop.setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS);
+