From b7cd96eaeb85474ee2ddec1de92181a3b88ceece Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 2 Mar 2022 15:10:53 +0000 Subject: [PATCH] =?utf8?q?JAL-3619=20fix=20up=20error=20messages=20and=20try?= =?utf8?q?=20to=20bail=20quietly=20if=20the=20viewer=20doesn=E2=80=99t=20ope?= =?utf8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java | 2 +- src/jalview/gui/ChimeraViewFrame.java | 6 ++++++ src/jalview/gui/PymolBindingModel.java | 2 +- src/jalview/gui/PymolViewer.java | 10 +++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) 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 { -- 1.7.10.2