JAL-3224 JAL-3225 Added lines to check for updates to getdown-launcher.jar into Jalvi...
[jalview.git] / src / jalview / bin / Jalview.java
index cda02fc..b5fa7fa 100755 (executable)
@@ -41,8 +41,6 @@ import jalview.util.MessageManager;
 import jalview.util.Platform;
 import jalview.ws.jws2.Jws2Discoverer;
 
-import java.awt.Image;
-import java.awt.Taskbar;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -54,11 +52,6 @@ import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
-import java.security.AllPermission;
-import java.security.CodeSource;
-import java.security.PermissionCollection;
-import java.security.Permissions;
-import java.security.Policy;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Vector;
@@ -66,6 +59,9 @@ import java.util.Vector;
 import javax.swing.LookAndFeel;
 import javax.swing.UIManager;
 
+import com.sun.xml.ws.policy.Policy;
+import com.threerings.getdown.util.LaunchUtil;
+
 import groovy.lang.Binding;
 import groovy.util.GroovyScriptEngine;
 
@@ -98,6 +94,8 @@ public class Jalview
   static
   {
     // grab all the rights we can the JVM
+    Policy.createEmptyPolicy();
+    /*
     Policy.setPolicy(new Policy()
     {
       @Override
@@ -107,12 +105,13 @@ public class Jalview
         perms.add(new AllPermission());
         return (perms);
       }
-
+    
       @Override
       public void refresh()
       {
       }
     });
+    */
   }
 
   /**
@@ -203,6 +202,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;
 
@@ -338,26 +354,15 @@ public class Jalview
       desktop = new Desktop();
       desktop.setInBatchMode(true); // indicate we are starting up
 
-      if (Taskbar.isTaskbarSupported())
+      try
       {
-        Taskbar tb = Taskbar.getTaskbar();
-        if (tb.isSupported(Taskbar.Feature.ICON_IMAGE))
-        {
-          try
-          {
-            java.net.URL url = getClass()
-                    .getResource("/images/JalviewLogo_Huge.png");
-            if (url != null)
-            {
-              Image image = java.awt.Toolkit.getDefaultToolkit()
-                      .createImage(url);
-              tb.setIconImage(image);
-            }
-          } catch (Exception e)
-          {
-            e.printStackTrace();
-          }
-        }
+        JalviewTaskbar.setTaskbar(this);
+      } catch (Exception e)
+      {
+        e.printStackTrace();
+      } catch (Throwable t)
+      {
+        t.printStackTrace();
       }
 
       desktop.setVisible(true);
@@ -988,7 +993,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)
       {