From: Jim Procter Date: Wed, 2 Mar 2022 15:10:53 +0000 (+0000) Subject: JAL-3619 fix up error messages and try to bail quietly if the viewer doesn’t open X-Git-Tag: Release_2_11_2_1~51 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b7cd96eaeb85474ee2ddec1de92181a3b88ceece;p=jalview.git JAL-3619 fix up error messages and try to bail quietly if the viewer doesn’t open --- diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index c78a82b..399bad9 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -311,7 +311,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel @Override public boolean isViewerRunning() { - return chimeraManager.isChimeraLaunched(); + return chimeraManager!=null && chimeraManager.isChimeraLaunched(); } /** diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 4f1f26b..3a17ea3 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -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) { diff --git a/src/jalview/gui/PymolBindingModel.java b/src/jalview/gui/PymolBindingModel.java index 6aba7b6..42a537b 100644 --- a/src/jalview/gui/PymolBindingModel.java +++ b/src/jalview/gui/PymolBindingModel.java @@ -121,7 +121,7 @@ public class PymolBindingModel extends AAStructureBindingModel @Override public boolean isViewerRunning() { - return pymolManager.isPymolLaunched(); + return pymolManager !=null && pymolManager.isPymolLaunched(); } @Override diff --git a/src/jalview/gui/PymolViewer.java b/src/jalview/gui/PymolViewer.java index 3b6ea99..2fd4957 100644 --- a/src/jalview/gui/PymolViewer.java +++ b/src/jalview/gui/PymolViewer.java @@ -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 {