Merge branch 'develop' into feature/JAL-3390hideUnmappedStructure
[jalview.git] / src / jalview / ext / jmol / JmolParser.java
index 2a510a2..a9c5f5c 100644 (file)
@@ -45,9 +45,9 @@ import org.jmol.c.STR;
 import org.jmol.modelset.ModelSet;
 import org.jmol.viewer.Viewer;
 
-import MCview.Atom;
-import MCview.PDBChain;
-import MCview.Residue;
+import mc_view.Atom;
+import mc_view.PDBChain;
+import mc_view.Residue;
 
 /**
  * Import and process files with Jmol for file like PDB, mmCIF
@@ -59,13 +59,14 @@ public class JmolParser extends StructureFile implements JmolStatusListener
 {
   Viewer viewer = null;
 
-  public JmolParser(boolean immediate, String inFile,
+  public JmolParser(boolean immediate, Object inFile,
           DataSourceType sourceType) throws IOException
   {
+    // BH 2018 File or String for filename
     super(immediate, inFile, sourceType);
   }
 
-  public JmolParser(String inFile, DataSourceType sourceType)
+  public JmolParser(Object inFile, DataSourceType sourceType)
           throws IOException
   {
     super(inFile, sourceType);
@@ -133,8 +134,8 @@ public class JmolParser extends StructureFile implements JmolStatusListener
          * params -o (output to sysout) -n (nodisplay) -x (exit when finished)
          * see http://wiki.jmol.org/index.php/Jmol_Application
          */
-        viewer = (Viewer) JmolViewer.allocateViewer(null, null, null, null,
-                null, "-x -o -n", this);
+        
+        viewer = JalviewJmolBinding.getJmolData(this);
         // ensure the 'new' (DSSP) not 'old' (Ramachandran) SS method is used
         viewer.setBooleanProperty("defaultStructureDSSP", true);
       } catch (ClassCastException x)
@@ -171,16 +172,16 @@ public class JmolParser extends StructureFile implements JmolStatusListener
       List<Atom> significantAtoms = convertSignificantAtoms(ms);
       for (Atom tmpatom : significantAtoms)
       {
-        try
+        if (tmpatom.resNumIns.trim().equals(lastID))
+        {
+          // phosphorylated protein - seen both CA and P..
+          continue;
+        }
+        tmpchain = findChain(tmpatom.chain);
+        if (tmpchain != null)
         {
-          tmpchain = findChain(tmpatom.chain);
-          if (tmpatom.resNumIns.trim().equals(lastID))
-          {
-            // phosphorylated protein - seen both CA and P..
-            continue;
-          }
           tmpchain.atoms.addElement(tmpatom);
-        } catch (Exception e)
+        } else
         {
           tmpchain = new PDBChain(getId(), tmpatom.chain);
           getChains().add(tmpchain);