final java.io.File choice = chooser.getSelectedFile();
setProjectFile(choice);
+ // TODO or move inside the new Thread?
+ saveChimeraSessions(choice.getAbsolutePath());
+
new Thread(new Runnable()
{
public void run()
}
}
+ /**
+ * Request any open, linked Chimera sessions to save their state.
+ *
+ * @param jalviewProjectFilename
+ * the filename of the Jalview project; Chimera session files should
+ * be given distinct, but obviously related, names.
+ */
+ public void saveChimeraSessions(String jalviewProjectFilename)
+ {
+ int i = 0;
+ for (JInternalFrame frame : getAllFrames())
+ {
+ if (frame instanceof ChimeraViewFrame)
+ {
+ /*
+ * Construct a filename for the Chimera session by append _chimera<n>.py
+ * to the Jalview project file name.
+ */
+ String chimeraPath = jalviewProjectFilename + "_chimera_" + i
+ + ".py";
+ ((ChimeraViewFrame) frame).saveSession(chimeraPath);
+ i++;
+ }
+ }
+ }
+
private void setProjectFile(File choice)
{
this.projectFile = choice;