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;
String lastHighlightCommand;
- private Thread chimeraMonitor;
-
/**
* Open a PDB structure file in Chimera and set up mappings from Jalview.
*
}
/**
- * 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
*/
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();
- }
}
/**
boolean launched = chimeraManager.launchChimera(getChimeraPaths());
if (launched)
{
- startChimeraProcessMonitor();
+ startExternalViewerMonitor(chimeraManager.getChimeraProcess());
}
else
{
atomSpecs.add(spec);
} catch (IllegalArgumentException e)
{
- System.err.println("Failed to parse atomspec: " + atomSpec);
+ Cache.log.error("Failed to parse atomspec: " + atomSpec);
}
}
return atomSpecs;