Merge branch 'develop' into trialMerge
[jalview.git] / src / jalview / bin / Jalview.java
index 66375e1..857bd84 100755 (executable)
@@ -67,6 +67,8 @@ import java.util.logging.Logger;
 import javax.swing.LookAndFeel;
 import javax.swing.UIManager;
 
+import com.threerings.getdown.util.LaunchUtil;
+
 import groovy.lang.Binding;
 import groovy.util.GroovyScriptEngine;
 
@@ -87,34 +89,13 @@ import groovy.util.GroovyScriptEngine;
  */
 public class Jalview
 {
-  // @formatter:off
-       /**
-   * find first query parameter (if any) that doesn't start with j2s
-   * and set as space-delimited arguments to Jalview main
-   * 
-   * @j2sNative
-   *  var hr = decodeURI(document.location.href);
-   *  var pos = hr.indexOf("?");
-   *  if (pos > 0)
-   *  {
-   *     q = hr.substring(pos+1);
-   *     args = q.split("&");
-   *     for (i = 0 ; i < args.length; i++)
-   *     {
-   *      arg1 = args[i];
-   *      if (!arg1.startsWith("j2s"))
-   *      {
-   *       thisApplet.__Info.args = arg1.split(" ");
-   *       break;
-   *      }
-   *     }
-   *  }
-   */
-  // @formatter:on
+  static
+  {
+    Platform.getURLCommandArguments();
+  }
+
+  // singleton instance of this class
 
-  /*
-   * singleton instance of this class
-   */
   private static Jalview instance;
 
   private Desktop desktop;
@@ -127,7 +108,7 @@ public class Jalview
     /**
      * Java only
      * 
-     * @j2sNative
+     * @j2sIgnore
      */
     {
       // grab all the rights we can for the JVM
@@ -239,12 +220,21 @@ public class Jalview
   @SuppressWarnings("unused")
   private static void setLogging() 
   {
+
+    /**
+     * @j2sIgnore
+     * 
+     */
+    {
+      System.out.println("not in js");
+    }
+
          // BH - for event debugging in JavaScript (Java mode only)
-    if (!Platform.isJS())// !(/** @j2sNative true ||*/false))
+    if (!Platform.isJS())
     /**
      * Java only
      * 
-     * @j2sNative
+     * @j2sIgnore
      */
        {
                Logger.getLogger("").setLevel(Level.ALL);
@@ -277,6 +267,23 @@ public class Jalview
             + System.getProperty("os.name") + " "
             + System.getProperty("os.version"));
 
+    String appdirString = System.getProperty("getdownappdir");
+    if (appdirString != null && appdirString.length() > 0)
+    {
+      final File appdir = new File(appdirString);
+      new Thread()
+      {
+        @Override
+        public void run()
+        {
+          LaunchUtil.upgradeGetdown(
+                  new File(appdir, "getdown-launcher-old.jar"),
+                  new File(appdir, "getdown-launcher.jar"),
+                  new File(appdir, "getdown-launcher-new.jar"));
+        }
+      }.start();
+
+    }
     ArgsParser aparser = new ArgsParser(args);
     boolean headless = false;
 
@@ -290,9 +297,9 @@ public class Jalview
 
     if (!Platform.isJS())
     /**
-     * ignore in JavaScript
+     * Java only
      * 
-     * @j2sNative
+     * @j2sIgnore
      */
     {
       if (aparser.contains("help") || aparser.contains("h"))
@@ -429,13 +436,27 @@ public class Jalview
 //       }
       ;
       desktop.setInBatchMode(true); // indicate we are starting up
+
+      try
+      {
+        JalviewTaskbar.setTaskbar(this);
+      } catch (Exception e)
+      {
+        System.out.println("Cannot set Taskbar");
+        // e.printStackTrace();
+      } catch (Throwable t)
+      {
+        System.out.println("Cannot set Taskbar");
+        // t.printStackTrace();
+      }
+
       desktop.setVisible(true);
 
       if (!Platform.isJS())
       /**
        * Java only
        * 
-       * @j2sNative
+       * @j2sIgnore
        */
       {
         desktop.startServiceDiscovery();
@@ -609,7 +630,7 @@ public class Jalview
         /**
          * ignore in JavaScript -- can't just file existence - could load it?
          * 
-         * @j2sNative
+         * @j2sIgnore
          */
       {
         if (!file.startsWith("http://") && !file.startsWith("https://"))
@@ -838,13 +859,13 @@ public class Jalview
     // And the user
     // ////////////////////
 
-    if (!Platform.isJS() && // /** @j2sNative false && */ // BH 2018
-    !headless && file == null && vamsasImport == null
+    if (!Platform.isJS() && !headless && file == null
+            && vamsasImport == null
             && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true))
     /**
      * Java only
      * 
-     * @j2sNative
+     * @j2sIgnore
      */
     {
       file = jalview.bin.Cache.getDefault("STARTUP_FILE",
@@ -1083,7 +1104,7 @@ public class Jalview
     }
     try
     {
-      Map<String, Object> vbinding = new HashMap<>();
+      Map<String, java.lang.Object> vbinding = new HashMap<>();
       vbinding.put("Jalview", this);
       if (af != null)
       {