JAL-3619 fix up error messages and try to bail quietly if the viewer doesn’t open
authorJim Procter <j.procter@dundee.ac.uk>
Wed, 2 Mar 2022 15:10:53 +0000 (15:10 +0000)
committerJim Procter <j.procter@dundee.ac.uk>
Wed, 2 Mar 2022 15:10:53 +0000 (15:10 +0000)
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
src/jalview/gui/ChimeraViewFrame.java
src/jalview/gui/PymolBindingModel.java
src/jalview/gui/PymolViewer.java

index c78a82b..399bad9 100644 (file)
@@ -311,7 +311,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
   @Override
   public boolean isViewerRunning()
   {
-    return chimeraManager.isChimeraLaunched();
+    return chimeraManager!=null && chimeraManager.isChimeraLaunched();
   }
 
   /**
index 4f1f26b..3a17ea3 100644 (file)
@@ -445,6 +445,12 @@ public class ChimeraViewFrame extends StructureViewerBase
           Console.error("Couldn't open Chimera viewer!", ex);
         }
       }
+      if (!jmb.isViewerRunning())
+      {
+        // nothing to do
+        // TODO: ensure we tidy up JAL-3619
+        return;
+      }
       int num = -1;
       for (PDBEntry pe : filePDB)
       {
index 6aba7b6..42a537b 100644 (file)
@@ -121,7 +121,7 @@ public class PymolBindingModel extends AAStructureBindingModel
   @Override
   public boolean isViewerRunning()
   {
-    return pymolManager.isPymolLaunched();
+    return pymolManager !=null && pymolManager.isPymolLaunched();
   }
 
   @Override
index 3b6ea99..2fd4957 100644 (file)
@@ -215,6 +215,14 @@ public class PymolViewer extends StructureViewerBase
           return;
         }
       }
+      if (!binding.isViewerRunning())
+      {
+        // nothing to do
+        // TODO: ensure we tidy up JAL-3619
+
+        return;
+      }
+
       int num = -1;
       for (PDBEntry pe : filePDB)
       {
@@ -252,7 +260,7 @@ public class PymolViewer extends StructureViewerBase
           } catch (Exception ex)
           {
             Console.error(
-                    "Couldn't open " + pe.getFile() + " in Chimera viewer!",
+                    "Couldn't open " + pe.getFile() + " in "+getViewerName()+"!",
                     ex);
           } finally
           {