GPL license added
[jalview.git] / src / jalview / bin / Jalview.java
index c54a347..2524abd 100755 (executable)
@@ -1,11 +1,21 @@
-/********************\r
- * 2004 Jalview Reengineered\r
- * Barton Group\r
- * Dundee University\r
- *\r
- * AM Waterhouse\r
- *******************/\r
-\r
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
 \r
 package jalview.bin;\r
 \r
@@ -23,6 +33,8 @@ public class Jalview extends JApplet
   public void init()\r
   {\r
     applet = this;\r
+    Cache.loadProperties();\r
+    jalview.gui.Preferences.initPreferences();\r
 \r
     frame = new Desktop();\r
     frame.setResizable(true);\r
@@ -63,7 +75,11 @@ public class Jalview extends JApplet
 \r
   private static void initLogger() {\r
     Logger l = Logger.getLogger("org.apache.axis");\r
-    l.setLevel(Level.INFO);\r
+    if (Cache.getProperty("logs.Axis.Level")==null) {\r
+      Cache.setProperty("logs.Axis.Level", Level.INFO.toString());\r
+    }\r
+\r
+    l.setLevel(Level.toLevel(Cache.getProperty("logs.Axis.Level")));\r
     ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),"System.err");\r
     ap.setName("Axis");\r
     l.addAppender(ap);\r
@@ -71,10 +87,12 @@ public class Jalview extends JApplet
    public static void main(String[] args) {\r
 \r
     Cache.loadProperties();\r
+    jalview.gui.Preferences.initPreferences();\r
     try {\r
       initLogger();\r
     } catch (Exception e) {\r
-      System.out.println("Failed to initialise the log4j system for axis\n"+e);\r
+      System.err.println("Problems initializing the log4j system\n");\r
+      e.printStackTrace();\r
     }\r
     try{\r
        UIManager.setLookAndFeel(\r
@@ -90,15 +108,20 @@ public class Jalview extends JApplet
      catch (Exception ex)\r
      {}\r
 \r
-    // JFrame.setDefaultLookAndFeelDecorated(true);\r
      Desktop frame = new Desktop();\r
      frame.setResizable(true);\r
      frame.setVisible(true);\r
 \r
 \r
+\r
      if(args!=null && args.length>0)\r
      {\r
-         String file = args[0];\r
+         String file=null;\r
+         if(args[0].equals("-open"))\r
+           file = args[1];\r
+         else\r
+           file = args[0];\r
+\r
          String protocol = "File";\r
          if(file.indexOf("http:")>-1)\r
            protocol = "URL";\r
@@ -108,6 +131,25 @@ public class Jalview extends JApplet
          frame.LoadFile(file, protocol, format);\r
      }\r
 \r
+     if(jalview.gui.Preferences.showStartupFile &&\r
+         jalview.gui.Preferences.startupFile!=null)\r
+     {\r
+       String file = jalview.gui.Preferences.startupFile;\r
+       String protocol = "File";\r
+       if (file.indexOf("http:") > -1)\r
+         protocol = "URL";\r
+\r
+       if(file.endsWith(".jar"))\r
+         Jalview2XML.LoadJalviewAlign(file);\r
+       else\r
+       {\r
+         String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+         frame.LoadFile(file, protocol, format);\r
+       }\r
+     }\r
+\r
+\r
+\r
    }\r
 \r
 }\r