JAL-1988 tidying, plus don't add Preferences to Tools menu on a Mac\!
authorBen Soares <bsoares@dundee.ac.uk>
Thu, 8 Nov 2018 14:46:17 +0000 (14:46 +0000)
committerBen Soares <bsoares@dundee.ac.uk>
Thu, 8 Nov 2018 14:46:17 +0000 (14:46 +0000)
src/jalview/gui/Desktop.java
src/jalview/jbgui/GDesktop.java

index b2d63a9..647971e 100644 (file)
@@ -361,63 +361,66 @@ public class Desktop extends jalview.jbgui.GDesktop
      * change the line numbers
      */
 
+    /*
     if (!Platform.isAMac())
     {
       // this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
     }
     else
-    {
-      // this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
-      java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
+    */
+    // {
+    // this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+    java.awt.Desktop hdesktop = java.awt.Desktop.getDesktop();
 
-      desktop.setAboutHandler(new AboutHandler()
+    hdesktop.setAboutHandler(new AboutHandler()
+    {
+      @Override
+      public void handleAbout(AboutEvent e)
       {
-        @Override
-        public void handleAbout(AboutEvent e)
-        {
-          aboutMenuItem_actionPerformed(null);
-        }
-      });
-      desktop.setPreferencesHandler(new PreferencesHandler()
+        aboutMenuItem_actionPerformed(null);
+      }
+    });
+    hdesktop.setPreferencesHandler(new PreferencesHandler()
+    {
+      @Override
+      public void handlePreferences(PreferencesEvent e)
       {
-        @Override
-        public void handlePreferences(PreferencesEvent e)
+        preferences_actionPerformed(null);
+      }
+    });
+    hdesktop.setQuitHandler(new QuitHandler()
+    {
+      @Override
+      public void handleQuitRequestWith(QuitEvent e, QuitResponse r)
+      {
+        int n = JOptionPane.showConfirmDialog(null,
+                MessageManager.getString("label.quit_jalview"),
+                MessageManager.getString("action.quit"),
+                JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,
+                null);
+        if (n == JOptionPane.OK_OPTION)
         {
-          preferences_actionPerformed(null);
+          System.out.println("Shortcut Quit confirmed by user");
+          quit();
         }
-      });
-      desktop.setQuitHandler(new QuitHandler()
-      {
-        @Override
-        public void handleQuitRequestWith(QuitEvent e, QuitResponse r)
-        {
-          int n = JOptionPane.showConfirmDialog(null,
-                  MessageManager.getString("label.quit_jalview"),
-                  MessageManager.getString("action.quit"),
-                  JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE,
-                  null);
-          if (n == JOptionPane.OK_OPTION)
-          {
-            System.out.println("Shortcut Quit confirmed by user");
-            quit();
-          }
-          else
-          {
-            System.out.println("Shortcut Quit cancelled by user");
-          }
+        else
+        {
+          System.out.println("Shortcut Quit cancelled by user");
         }
-      });
+      }
+    });
 
-      addWindowListener(new WindowAdapter()
-      {
+    // }
 
-        @Override
-        public void windowClosing(WindowEvent ev)
-        {
-          quit();
-        }
-      });
-    }
+    addWindowListener(new WindowAdapter()
+    {
+
+      @Override
+      public void windowClosing(WindowEvent ev)
+      {
+        quit();
+      }
+    });
 
     boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
             false);
index 1e51541..f1a2318 100755 (executable)
@@ -435,7 +435,10 @@ public class GDesktop extends JFrame
     VamsasMenu.add(vamsasImport);
     VamsasMenu.add(vamsasSave);
     VamsasMenu.add(vamsasStop);
-    toolsMenu.add(preferences);
+    if (!Platform.isAMac())
+    {
+      toolsMenu.add(preferences);
+    }
     toolsMenu.add(showMemusage);
     toolsMenu.add(showConsole);
     toolsMenu.add(showNews);