*/
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 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!
*
*/
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
+ {
+ // TODO: if (!Platform.isJS()
+ 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(Platform.getAppID("desktop"));
FileMenu.setText(MessageManager.getString("action.file"));
FileMenu.add(saveAsState);
FileMenu.add(loadState);
FileMenu.addSeparator();
- FileMenu.add(quit);
- HelpMenu.add(aboutMenuItem);
+ if (!APQHandlers.setQuit)
+ {
+ FileMenu.add(quit);
+ }
+ if (!APQHandlers.setAbout)
+ {
+ HelpMenu.add(aboutMenuItem);
+ }
HelpMenu.add(documentationMenuItem);
- if (!Platform.isAMacAndNotJS() || specversion < 11)
+ if (!APQHandlers.setPreferences)
{
toolsMenu.add(preferences);
}