X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGDesktop.java;h=98217b19dd1e673dab178808880a5dbeabe10487;hp=e1224c2c56fc2b3b0c70a14ff875f1983badbee8;hb=ac63b721ce80f32a04a6d0eeff29192bad50972e;hpb=57738a1f3c19b1c3a00bd3ac5108f8cd0af32f99 diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index e1224c2..98217b1 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -20,11 +20,6 @@ */ package jalview.jbgui; -import jalview.api.AlignmentViewPanel; -import jalview.io.FileFormatException; -import jalview.util.MessageManager; -import jalview.util.Platform; - import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -35,6 +30,12 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; +import jalview.api.AlignmentViewPanel; +import jalview.bin.Cache; +import jalview.io.FileFormatException; +import jalview.util.MessageManager; +import jalview.util.Platform; + /** * DOCUMENT ME! * @@ -139,6 +140,26 @@ public class GDesktop extends JFrame */ private void jbInit() throws Exception { + boolean apqHandlersSet = false; + /** + * APQHandlers sets handlers for About, Preferences and Quit actions + * peculiar to macOS's application menu. APQHandlers will check to see if a + * handler is supported before setting it. + */ + try + { + apqHandlersSet = APQHandlers.setAPQHandlers(this); + } catch (Exception e) + { + System.out.println("Cannot set APQHandlers"); + // e.printStackTrace(); + } catch (Throwable t) + { + jalview.bin.Console + .warn("Error setting APQHandlers: " + t.toString()); + jalview.bin.Console.trace(Cache.getStackTraceString(t)); + } + setName("jalview-desktop"); FileMenu.setText(MessageManager.getString("action.file")); HelpMenu.setText(MessageManager.getString("action.help")); @@ -369,10 +390,6 @@ public class GDesktop extends JFrame } }); - Float specversion = Platform.isJS() ? Float.valueOf(8) - : Float.parseFloat( - System.getProperty("java.specification.version")); - desktopMenubar.add(FileMenu); desktopMenubar.add(toolsMenu); desktopMenubar.add(HelpMenu); @@ -385,9 +402,12 @@ public class GDesktop extends JFrame FileMenu.add(loadState); FileMenu.addSeparator(); FileMenu.add(quit); - HelpMenu.add(aboutMenuItem); + if (!apqHandlersSet) + { + HelpMenu.add(aboutMenuItem); + } HelpMenu.add(documentationMenuItem); - if (!Platform.isAMacAndNotJS() || specversion < 11) + if (!apqHandlersSet) { toolsMenu.add(preferences); }