update of javajs package; adds org.apache.harmony, org.xml.sax.helpers
[jalview.git] / src / jalview / bin / Jalview.java
index 287096d..2007814 100755 (executable)
@@ -61,6 +61,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Vector;
 
+import javax.swing.LookAndFeel;
 import javax.swing.UIManager;
 
 import groovy.lang.Binding;
@@ -76,6 +77,9 @@ import groovy.util.GroovyScriptEngine;
  */
 public class Jalview
 {
+
+  // BH 6/19/2018 starting to work on JS version - just discovering issues
+
   /*
    * singleton instance of this class
    */
@@ -85,8 +89,14 @@ public class Jalview
 
   public static AlignFrame currentAlignFrame;
 
+  public static boolean isJS = /** @j2sNative true || */ // BH 2018
+          false;
+
   static
   {
+
+    if (!isJS)
+    { // BH 2018
     // grab all the rights we can the JVM
     Policy.setPolicy(new Policy()
     {
@@ -103,6 +113,8 @@ public class Jalview
       {
       }
     });
+
+    }
   }
 
   /**
@@ -187,7 +199,12 @@ public class Jalview
    */
   void doMain(String[] args)
   {
-    System.setSecurityManager(null);
+
+    if (!isJS)
+    {
+      System.setSecurityManager(null);
+    }
+
     System.out
             .println("Java version: " + System.getProperty("java.version"));
     System.out.println(System.getProperty("os.arch") + " "
@@ -280,25 +297,32 @@ public class Jalview
     }
     if (Platform.isAMac())
     {
+
+      LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager
+              .getLookAndFeel();
       System.setProperty("com.apple.mrj.application.apple.menu.about.name",
               "Jalview");
       System.setProperty("apple.laf.useScreenMenuBar", "true");
-      try
-      {
-        UIManager.setLookAndFeel(
-                ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel());
-      } catch (Throwable e)
+      if (lookAndFeel != null)
       {
-        System.err.println(
-                "Failed to set QuaQua look and feel: " + e.toString());
+        try
+        {
+          UIManager.setLookAndFeel(lookAndFeel);
+        } catch (Throwable e)
+        {
+          System.err.println(
+                  "Failed to set QuaQua look and feel: " + e.toString());
+        }
       }
-      if (!ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel()
-              .equals(UIManager.getLookAndFeel()))
+      if (lookAndFeel == null || !(lookAndFeel.getClass()
+              .isAssignableFrom(UIManager.getLookAndFeel().getClass()))
+              || !UIManager.getLookAndFeel().getClass().toString()
+                      .toLowerCase().contains("quaqua"))
       {
         try
         {
           System.err.println(
-                  "Quaqua LaF not available. Using VAqua(4).");
+                  "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976");
           UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
         } catch (Throwable e)
         {