Jalview-JS/JAL-3253-applet additional static final preferences
[jalview.git] / src / jalview / bin / Jalview.java
index 808acc4..07fd4d6 100755 (executable)
@@ -27,6 +27,7 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.ext.so.SequenceOntology;
 import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
 import jalview.gui.Desktop;
 import jalview.gui.Preferences;
 import jalview.gui.PromptUserConfig;
@@ -480,7 +481,7 @@ public class Jalview implements ApplicationSingletonI
           }
           else
           {
-            if (Cache.getProperty("NOQUESTIONNAIRES") == null)
+            if (Cache.getProperty(Preferences.NOQUESTIONNAIRES) == null)
             {
               // Start the desktop questionnaire prompter with the specified
               // questionnaire
@@ -509,8 +510,6 @@ public class Jalview implements ApplicationSingletonI
       }
     }
 
-    String data = null;
-    FileLoader fileLoader = new FileLoader(!headless);
 
     // script to execute after all loading is
     // completed one way or another
@@ -543,7 +542,6 @@ public class Jalview implements ApplicationSingletonI
                         .getString("status.processing_commandline_args"),
                 progress = System.currentTimeMillis());
       }
-      System.out.println("CMD [-open " + file + "] executed successfully!");
 
       if (!isJS)
       /**
@@ -583,7 +581,8 @@ public class Jalview implements ApplicationSingletonI
         // TODO ?
       }
 
-      AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
+      AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
+              protocol,
               format);
       if (af == null)
       {
@@ -591,11 +590,39 @@ public class Jalview implements ApplicationSingletonI
       }
       else
       {
+        System.out
+                .println("CMD [-open " + file + "] executed successfully!");
+        if (file2 != null)
+        {
+          protocol = AppletFormatAdapter.checkProtocol(file2);
+          try
+          {
+            format = new IdentifyFile().identify(file2, protocol);
+          } catch (FileFormatException e1)
+          {
+            // TODO ?
+          }
+          AlignFrame af2 = new FileLoader(!headless).loadFileWaitTillLoaded(
+                  file2,
+                  protocol, format);
+          if (af2 == null)
+          {
+            System.out.println("error");
+          }
+          else
+          {
+            AlignViewport.openLinkedAlignmentAs(af,
+                    af.getViewport().getAlignment(),
+                    af2.getViewport().getAlignment(), "",
+                    AlignViewport.SPLIT_FRAME);
+          }
+        }
+
         setCurrentAlignFrame(af);
 
         // TODO: file2 How to implement file2 for the applet spit screen?
 
-        data = aparser.getValue(ArgsParser.COLOUR, true);
+        String data = aparser.getValue(ArgsParser.COLOUR, true);
         if (data != null)
         {
           data.replaceAll("%20", " ");
@@ -691,15 +718,16 @@ public class Jalview implements ApplicationSingletonI
           loadAppletParams(aparser, af);
         }
         else if (!isJS)
-          /**
-           * Java only
-           * 
-           * @j2sIgnore
-           */
+        /**
+         * Java only
+         * 
+         * @j2sIgnore
+         */
         {
           if (groovyscript != null)
           {
-            // Execute the groovy script after we've done all the rendering stuff
+            // Execute the groovy script after we've done all the rendering
+            // stuff
             // and before any images or figures are generated.
             System.out.println("Executing script " + groovyscript);
             executeGroovyScript(groovyscript, af);
@@ -763,7 +791,8 @@ public class Jalview implements ApplicationSingletonI
         }
       }
 
-      startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
+      startUpAlframe = new FileLoader(!headless)
+              .loadFileWaitTillLoaded(file, protocol,
               format);
       // extract groovy arguments before anything else.
     }
@@ -1277,8 +1306,7 @@ public class Jalview implements ApplicationSingletonI
       @Override
       public boolean loadScoreFile(String sScoreFile) throws IOException
       {
-        af.loadJalviewDataFile(sScoreFile, null,
-                null, null);
+        af.loadJalviewDataFile(sScoreFile, null, null, null);
         return true;
       }
 
@@ -1336,7 +1364,6 @@ public class Jalview implements ApplicationSingletonI
     };
 
     new JalviewAppLoader(true).load(app);
-
   }
 
 }