JAL-1333 allow reuse of existing viewers (of a specified or currently preferred type)
authorj.procter@dundee.ac.uk <jprocter@Jims-MacBook-Pro-2.local>
Tue, 8 Jul 2014 19:16:49 +0000 (15:16 -0400)
committerj.procter@dundee.ac.uk <jprocter@Jims-MacBook-Pro-2.local>
Tue, 8 Jul 2014 19:16:49 +0000 (15:16 -0400)
src/jalview/gui/StructureViewer.java

index e307aa9..ccb3c18 100644 (file)
@@ -68,16 +68,40 @@ public class StructureViewer
   {
     return viewStructures(getViewerType(), ap, pr, collateForPDB);
   }
-  public JalviewStructureDisplayI viewStructures(Viewer viewerType,AlignmentPanel ap,
-          PDBEntry[] pr, SequenceI[][] collateForPDB)
+
+  public JalviewStructureDisplayI viewStructures(Viewer viewerType,
+          AlignmentPanel ap, PDBEntry[] pr, SequenceI[][] collateForPDB)
   {
     JalviewStructureDisplayI sview = null;
-    if (viewerType.equals(Viewer.JMOL)){
+    if (viewerType.equals(Viewer.JMOL))
+    {
       sview = new AppJmol(ap, pr, ap.av.collateForPDB(pr));
-    } else
-    if (viewerType.equals(Viewer.CHIMERA)) {
+    }
+    else if (viewerType.equals(Viewer.CHIMERA))
+    {
       sview = new ChimeraViewFrame(ap, pr, ap.av.collateForPDB(pr));
-    }else 
+    }
+    else
+    {
+      Cache.log.error("Unknown structure viewer type "
+              + getViewerType().toString());
+    }
+    return sview;
+  }
+
+  public JalviewStructureDisplayI viewStructures(Viewer viewerType,
+          AlignmentPanel ap, PDBEntry pr, SequenceI[] collateForPDB)
+  {
+    JalviewStructureDisplayI sview = null;
+    if (viewerType.equals(Viewer.JMOL))
+    {
+      sview = new AppJmol(pr, collateForPDB, null, ap);
+    }
+    else if (viewerType.equals(Viewer.CHIMERA))
+    {
+      sview = new ChimeraViewFrame(pr, collateForPDB, null, ap);
+    }
+    else
     {
       Cache.log.error("Unknown structure viewer type "
               + getViewerType().toString());
@@ -88,9 +112,7 @@ public class StructureViewer
   public JalviewStructureDisplayI viewStructures(PDBEntry pdb,
           SequenceI[] sequenceIs, Object object, AlignmentPanel ap)
   {
-    return viewStructures(ap, new PDBEntry[]
-    { pdb }, new SequenceI[][]
-    { sequenceIs });
+    return viewStructures(getViewerType(), ap, pdb, sequenceIs);
   }
 
   public JalviewStructureDisplayI createView(Viewer jmol, String[] pdbf,