+ if (Platform.isAMac())
+ {
+ if (desktopClass.getDeclaredMethod("setAboutHandler",
+ new Class[]
+ { java.awt.desktop.AboutHandler.class }) != null)
+ {
+
+ hdesktop.setAboutHandler(new java.awt.desktop.AboutHandler()
+ {
+ @Override
+ public void handleAbout(java.awt.desktop.AboutEvent e)
+ {
+ aboutMenuItem_actionPerformed(null);
+ }
+ });
+
+ }
+
+ if (desktopClass.getDeclaredMethod("setPreferencesHandler",
+ new Class[]
+ { java.awt.desktop.PreferencesHandler.class }) != null)
+ {
+
+ hdesktop.setPreferencesHandler(
+ new java.awt.desktop.PreferencesHandler()
+ {
+ @Override
+ public void handlePreferences(
+ java.awt.desktop.PreferencesEvent e)
+ {
+ preferences_actionPerformed(null);
+ }
+ });
+
+ }
+
+ if (desktopClass.getDeclaredMethod("setQuitHandler",
+ new Class[]
+ { java.awt.desktop.QuitHandler.class }) != null)
+ {
+
+ hdesktop.setQuitHandler(new java.awt.desktop.QuitHandler()
+ {
+ @Override
+ public void handleQuitRequestWith(
+ java.awt.desktop.QuitEvent e,
+ java.awt.desktop.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);
+
+ }
+ }