Merge branch 'develop' into patch/JAL-4110_stdout_for_tests
[jalview.git] / src / jalview / structures / models / AAStructureBindingModel.java
index 7d9674e..dcedafa 100644 (file)
@@ -780,7 +780,7 @@ public abstract class AAStructureBindingModel
 
     if (waiting)
     {
-      System.err.println(
+      jalview.bin.Console.errPrintln(
               "Timed out waiting for structure viewer to load file "
                       + notLoaded);
       return false;
@@ -884,14 +884,7 @@ public abstract class AAStructureBindingModel
       {
         for (int s : cs.getSelected())
         {
-          if (hiddenCols == null)
-          {
             matched.set(s);
-          }
-          else
-          {
-            matched.set(hiddenCols.visibleToAbsoluteColumn(s));
-          }
         }
       }
       else
@@ -1098,7 +1091,7 @@ public abstract class AAStructureBindingModel
    * @param getReply
    * @param msg
    */
-  protected List<String> executeCommands(List<StructureCommandI> commands,
+  public List<String> executeCommands(List<StructureCommandI> commands,
           boolean getReply, String msg)
   {
     return executeCommand(getReply, msg,
@@ -1546,6 +1539,31 @@ public abstract class AAStructureBindingModel
     return f;
   }
 
+
+  /**
+   * Use restoreSession when you want to restore a previously saved sesssion to
+   * the running viewer instance.
+   * 
+   * @param absolutePath
+   */
+  public void restoreSession(String absolutePath)
+  {
+    String prefix = getViewerType().toString();
+    try {
+
+      StructureCommandI cmd = commandGenerator.restoreSession(absolutePath);
+      if (cmd != null)
+      {
+        executeCommand(cmd, false);
+      }
+    } catch (Throwable e)
+    {
+      Console.error(String.format("Error restoring %s session: %s", prefix,
+              e.toString()));
+    }
+
+  }
+
   /**
    * Saves the structure viewer session to the given file
    *