Formatted source
[jalview.git] / src / jalview / bin / Jalview.java
index 2524abd..07958b4 100755 (executable)
 * 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
 import jalview.gui.*;\r
-import javax.swing.*;\r
-import java.awt.event.*;\r
+\r
 import jalview.io.*;\r
 \r
 import org.apache.log4j.*;\r
 \r
-public class Jalview extends JApplet\r
-{\r
-  public static JApplet applet;\r
-  Desktop frame;\r
-  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
-    frame.setVisible(true);\r
-    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
-    frame.addWindowListener(new WindowAdapter()\r
-    {\r
-      public void windowClosing(WindowEvent e)\r
-      {\r
-          applet.stop();\r
-          applet.destroy();\r
-      }\r
-    });\r
-\r
-    String file = getParameter("alignment");\r
-\r
-    if(file!=null)\r
-    {\r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);\r
-      String protocol = "File";\r
-      if (file.indexOf("http:") > -1)\r
-        protocol = "URL";\r
-\r
-      String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-\r
-      frame.LoadFile(file, protocol, format);\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class Jalview extends JApplet {\r
+    public static JApplet applet;\r
+    Desktop frame;\r
+\r
+    public void init() {\r
+        applet = this;\r
+        Cache.loadProperties();\r
+        jalview.gui.Preferences.initPreferences();\r
+\r
+        frame = new Desktop();\r
+        frame.setResizable(true);\r
+        frame.setVisible(true);\r
+        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
+        frame.addWindowListener(new WindowAdapter() {\r
+                public void windowClosing(WindowEvent e) {\r
+                    applet.stop();\r
+                    applet.destroy();\r
+                }\r
+            });\r
+\r
+        String file = getParameter("alignment");\r
+\r
+        if (file != null) {\r
+            jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);\r
+\r
+            String protocol = "File";\r
+\r
+            if (file.indexOf("http:") > -1) {\r
+                protocol = "URL";\r
+            }\r
+\r
+            String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+\r
+            frame.LoadFile(file, protocol, format);\r
+        }\r
     }\r
-  }\r
-\r
-  public void destroy()\r
-  {\r
-    if(applet!=null)\r
-      applet.stop();\r
-    else\r
-      System.exit(0);\r
-    frame.setVisible(false);\r
-  }\r
-\r
-  private static void initLogger() {\r
-    Logger l = Logger.getLogger("org.apache.axis");\r
-    if (Cache.getProperty("logs.Axis.Level")==null) {\r
-      Cache.setProperty("logs.Axis.Level", Level.INFO.toString());\r
+\r
+    public void destroy() {\r
+        if (applet != null) {\r
+            applet.stop();\r
+        } else {\r
+            System.exit(0);\r
+        }\r
+\r
+        frame.setVisible(false);\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
-  }\r
-   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.err.println("Problems initializing the log4j system\n");\r
-      e.printStackTrace();\r
+    private static void initLogger() {\r
+        Logger l = Logger.getLogger("org.apache.axis");\r
+\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
+\r
+        ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),\r
+                "System.err");\r
+        ap.setName("Axis");\r
+        l.addAppender(ap);\r
     }\r
-    try{\r
-       UIManager.setLookAndFeel(\r
-   //   "javax.swing.plaf.metal.MetalLookAndFeel"\r
-    //  "javax.swing.plaf.multi.MultiLookAndFeel"\r
-         UIManager.getSystemLookAndFeelClassName()\r
-     //    UIManager.getCrossPlatformLookAndFeelClassName()\r
-       // "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"\r
-       //   "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"\r
-       //  "com.sun.java.swing.plaf.motif.MotifLookAndFeel"\r
-     );\r
-     }\r
-     catch (Exception ex)\r
-     {}\r
-\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=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
-\r
-         String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-\r
-         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
+    public static void main(String[] args) {\r
+        Cache.loadProperties();\r
+        jalview.gui.Preferences.initPreferences();\r
+\r
+        try {\r
+            initLogger();\r
+        } catch (Exception e) {\r
+            System.err.println("Problems initializing the log4j system\n");\r
+            e.printStackTrace();\r
+        }\r
+\r
+        try {\r
+            UIManager.setLookAndFeel(\r
+            //   "javax.swing.plaf.metal.MetalLookAndFeel"\r
+            //  "javax.swing.plaf.multi.MultiLookAndFeel"\r
+            UIManager.getSystemLookAndFeelClassName());\r
+        } catch (Exception ex) {\r
+        }\r
+\r
+        Desktop frame = new Desktop();\r
+        frame.setResizable(true);\r
+        frame.setVisible(true);\r
+\r
+        if ((args != null) && (args.length > 0)) {\r
+            String file = null;\r
+\r
+            if (args[0].equals("-open")) {\r
+                file = args[1];\r
+            } else {\r
+                file = args[0];\r
+            }\r
+\r
+            String protocol = "File";\r
+\r
+            if (file.indexOf("http:") > -1) {\r
+                protocol = "URL";\r
+            }\r
+\r
+            String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+\r
+            frame.LoadFile(file, protocol, format);\r
+        }\r
+\r
+        if (jalview.gui.Preferences.showStartupFile &&\r
+                (jalview.gui.Preferences.startupFile != null)) {\r
+            String file = jalview.gui.Preferences.startupFile;\r
+            String protocol = "File";\r
+\r
+            if (file.indexOf("http:") > -1) {\r
+                protocol = "URL";\r
+            }\r
+\r
+            if (file.endsWith(".jar")) {\r
+                Jalview2XML.LoadJalviewAlign(file);\r
+            } else {\r
+                String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+                frame.LoadFile(file, protocol, format);\r
+            }\r
+        }\r
+    }\r
 }\r
-\r