From: j.procter@dundee.ac.uk Date: Tue, 8 Jul 2014 19:16:49 +0000 (-0400) Subject: JAL-1333 allow reuse of existing viewers (of a specified or currently preferred type) X-Git-Tag: Jalview_2_9~179^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=43aba7eb2064785994c924ab4667ec3a1f7e45c0;p=jalview.git JAL-1333 allow reuse of existing viewers (of a specified or currently preferred type) --- diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index e307aa9..ccb3c18 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -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,