JAL-3130 Turns out Quit/About/Preferences handlers are Mac specific, d'oh. Moved...
authorBen Soares <bsoares@dundee.ac.uk>
Tue, 11 Dec 2018 17:09:51 +0000 (17:09 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Tue, 11 Dec 2018 17:09:51 +0000 (17:09 +0000)
build-j11.xml [moved from build.xml with 100% similarity]
src/jalview/gui/Desktop.java

similarity index 100%
rename from build.xml
rename to build-j11.xml
index 7c08705..9e8624a 100644 (file)
@@ -381,80 +381,83 @@ public class Desktop extends jalview.jbgui.GDesktop
       try
       {
 
-        if (desktopClass.getDeclaredMethod("setAboutHandler",
-                new Class[]
-                { AboutHandler.class }) != null)
-        {
-
-          hdesktop.setAboutHandler(new AboutHandler()
-          {
-            @Override
-            public void handleAbout(AboutEvent e)
-            {
-              aboutMenuItem_actionPerformed(null);
-            }
-          });
-
-        }
-
-        if (desktopClass.getDeclaredMethod("setPreferencesHandler",
-                new Class[]
-                { PreferencesHandler.class }) != null)
-        {
-
-          hdesktop.setPreferencesHandler(new PreferencesHandler()
-          {
-            @Override
-            public void handlePreferences(PreferencesEvent e)
-            {
-              preferences_actionPerformed(null);
-            }
-          });
-
-        }
-
-        if (desktopClass.getDeclaredMethod("setQuitHandler",
-                new Class[]
-                { QuitHandler.class }) != null)
-        {
-
-          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);
-
-        }
+       if (Platform.isAMac())
+       {
+               if (desktopClass.getDeclaredMethod("setAboutHandler",
+                       new Class[]
+                       { AboutHandler.class }) != null)
+               {
+
+                 hdesktop.setAboutHandler(new AboutHandler()
+                 {
+                   @Override
+                   public void handleAbout(AboutEvent e)
+                   {
+                     aboutMenuItem_actionPerformed(null);
+                   }
+                 });
+
+               }
+
+               if (desktopClass.getDeclaredMethod("setPreferencesHandler",
+                       new Class[]
+                       { PreferencesHandler.class }) != null)
+               {
+
+                 hdesktop.setPreferencesHandler(new PreferencesHandler()
+                 {
+                   @Override
+                   public void handlePreferences(PreferencesEvent e)
+                   {
+                     preferences_actionPerformed(null);
+                   }
+                 });
+
+               }
+
+               if (desktopClass.getDeclaredMethod("setQuitHandler",
+                       new Class[]
+                       { QuitHandler.class }) != null)
+               {
+
+                 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);
+
+               }
+       }
 
       } catch (NoSuchMethodException e)
       {