JAL-629 --structureimage with formatting args.
[jalview.git] / src / jalview / gui / StructureViewer.java
index 0c12eb2..6cef665 100644 (file)
@@ -54,6 +54,16 @@ public class StructureViewer
    */
   private boolean superposeAdded = true;
 
+  /**
+   * whether to open structures in their own thread or not
+   */
+  private boolean async = true;
+
+  public void setAsync(boolean b)
+  {
+    async = b;
+  }
+
   public enum ViewerType
   {
     JMOL, CHIMERA, CHIMERAX, PYMOL
@@ -146,7 +156,8 @@ public class StructureViewer
     if (sview != null)
     {
       sview.setAlignAddedStructures(superposeAdded);
-      new Thread(new Runnable()
+
+      Runnable viewRunnable = new Runnable()
       {
         @Override
         public void run()
@@ -165,7 +176,15 @@ public class StructureViewer
 
           sview.updateTitleAndMenus();
         }
-      }).start();
+      };
+      if (async)
+      {
+        new Thread(viewRunnable).start();
+      }
+      else
+      {
+        viewRunnable.run();
+      }
       return sview;
     }
 
@@ -303,6 +322,11 @@ public class StructureViewer
 
   JalviewStructureDisplayI sview = null;
 
+  public JalviewStructureDisplayI getJalviewStructureDisplay()
+  {
+    return sview;
+  }
+
   public JalviewStructureDisplayI viewStructures(PDBEntry pdb,
           SequenceI[] seqsForPdb, AlignmentPanel ap)
   {