X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraBinding.java;fp=src%2Fjalview%2Fext%2Frbvi%2Fchimera%2FJalviewChimeraBinding.java;h=bc4eef4914cf6a76223326be2b63c4097fbe964a;hb=2fb924ec0d110eb3ca6c3fb06efa27acd34b2750;hp=460b15632c06954e54ed957730c7a10a48e13cf9;hpb=8939be9b96e7e3f7e836037b972ddce75fa4a17e;p=jalview.git diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 460b156..bc4eef4 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -37,7 +37,6 @@ import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel; import ext.edu.ucsf.rbvi.strucviz2.StructureManager; import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType; import jalview.api.AlignmentViewPanel; -import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.PDBEntry; @@ -78,8 +77,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel String lastHighlightCommand; - private Thread chimeraMonitor; - /** * Open a PDB structure file in Chimera and set up mappings from Jalview. * @@ -186,37 +183,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel } /** - * Starts a thread that waits for the Chimera process to finish, so that we can - * then close the associated resources. This avoids leaving orphaned Chimera - * viewer panels in Jalview if the user closes Chimera. - */ - protected void startChimeraProcessMonitor() - { - final Process p = chimeraManager.getChimeraProcess(); - chimeraMonitor = new Thread(new Runnable() - { - - @Override - public void run() - { - try - { - p.waitFor(); - JalviewStructureDisplayI display = getViewer(); - if (display != null) - { - display.closeViewer(false); - } - } catch (InterruptedException e) - { - // exit thread if Chimera Viewer is closed in Jalview - } - } - }); - chimeraMonitor.start(); - } - - /** * Start a dedicated HttpServer to listen for Chimera notifications, and tell it * to start listening */ @@ -241,21 +207,13 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel public void closeViewer(boolean closeChimera) { super.closeViewer(closeChimera); - if (closeChimera) - { - chimeraManager.exitChimera(); - } if (this.chimeraListener != null) { chimeraListener.shutdown(); chimeraListener = null; } + chimeraManager.clearOnChimeraExit(); chimeraManager = null; - - if (chimeraMonitor != null) - { - chimeraMonitor.interrupt(); - } } /** @@ -306,7 +264,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel boolean launched = chimeraManager.launchChimera(getChimeraPaths()); if (launched) { - startChimeraProcessMonitor(); + startExternalViewerMonitor(chimeraManager.getChimeraProcess()); } else { @@ -500,7 +458,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel atomSpecs.add(spec); } catch (IllegalArgumentException e) { - System.err.println("Failed to parse atomspec: " + atomSpec); + Cache.log.error("Failed to parse atomspec: " + atomSpec); } } return atomSpecs;