JAL-2976 fallback to Vaqua for Macs that don’t work for Quaqua
authorJim Procter <jprocter@issues.jalview.org>
Wed, 2 May 2018 14:41:51 +0000 (15:41 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 2 May 2018 14:41:51 +0000 (15:41 +0100)
src/jalview/bin/Jalview.java

index 9ec0033..287096d 100755 (executable)
@@ -20,9 +20,6 @@
  */
 package jalview.bin;
 
-import groovy.lang.Binding;
-import groovy.util.GroovyScriptEngine;
-
 import jalview.ext.so.SequenceOntology;
 import jalview.gui.AlignFrame;
 import jalview.gui.Desktop;
@@ -66,6 +63,9 @@ import java.util.Vector;
 
 import javax.swing.UIManager;
 
+import groovy.lang.Binding;
+import groovy.util.GroovyScriptEngine;
+
 /**
  * Main class for Jalview Application <br>
  * <br>
@@ -275,6 +275,8 @@ public class Jalview
       UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     } catch (Exception ex)
     {
+      System.err.println("Unexpected Look and Feel Exception");
+      ex.printStackTrace();
     }
     if (Platform.isAMac())
     {
@@ -290,6 +292,20 @@ public class Jalview
         System.err.println(
                 "Failed to set QuaQua look and feel: " + e.toString());
       }
+      if (!ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel()
+              .equals(UIManager.getLookAndFeel()))
+      {
+        try
+        {
+          System.err.println(
+                  "Quaqua LaF not available. Using VAqua(4).");
+          UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
+        } catch (Throwable e)
+        {
+          System.err.println(
+                  "Failed to reset look and feel: " + e.toString());
+        }
+      }
     }
 
     /*
@@ -970,7 +986,7 @@ public class Jalview
     }
     try
     {
-      Map<String, Object> vbinding = new HashMap<String, Object>();
+      Map<String, Object> vbinding = new HashMap<>();
       vbinding.put("Jalview", this);
       if (af != null)
       {
@@ -1036,7 +1052,7 @@ public class Jalview
                         + nickname + "|" + url);
         if (source == null)
         {
-          source = new Vector<String>();
+          source = new Vector<>();
         }
         source.addElement(nickname);
       }
@@ -1054,7 +1070,7 @@ public class Jalview
       System.out.println("adding source '" + data + "'");
       if (source == null)
       {
-        source = new Vector<String>();
+        source = new Vector<>();
       }
       source.addElement(data);
     }