JAL-3619 fix up warning message and minimal patch to make sure failed-to-launch viewe...
[jalview.git] / src / jalview / gui / PymolViewer.java
index d7b4236..3b6ea99 100644 (file)
@@ -14,7 +14,7 @@ import javax.swing.event.InternalFrameEvent;
 
 import jalview.api.AlignmentViewPanel;
 import jalview.api.FeatureRenderer;
-import jalview.bin.Cache;
+import jalview.bin.Console;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.datamodel.StructureViewerModel;
@@ -210,7 +210,9 @@ public class PymolViewer extends StructureViewerBase
           initPymol();
         } catch (Exception ex)
         {
-          Cache.log.error("Couldn't open PyMOL viewer!", ex);
+          Console.error("Couldn't open PyMOL viewer!", ex);
+          // if we couldn't open Pymol, no point continuing
+          return;
         }
       }
       int num = -1;
@@ -249,12 +251,12 @@ public class PymolViewer extends StructureViewerBase
             binding.stashFoundChains(pdb, pe.getFile());
           } catch (Exception ex)
           {
-            Cache.log.error(
+            Console.error(
                     "Couldn't open " + pe.getFile() + " in Chimera viewer!",
                     ex);
           } finally
           {
-            // Cache.log.debug("File locations are " + files);
+            // Cache.debug("File locations are " + files);
           }
         }
       }
@@ -314,6 +316,7 @@ public class PymolViewer extends StructureViewerBase
                       getViewerName()),
               MessageManager.getString("label.error_loading_file"),
               JvOptionPane.ERROR_MESSAGE);
+      binding.closeViewer(true);
       this.dispose();
       return;
     }
@@ -323,7 +326,7 @@ public class PymolViewer extends StructureViewerBase
       boolean opened = binding.openSession(pymolSessionFile);
       if (!opened)
       {
-        Cache.log.error(
+        Console.error(
                 "An error occurred opening PyMOL session file "
                 + pymolSessionFile);
       }