*/
package jalview.ext.rbvi.chimera;
-import jalview.api.AlignmentViewPanel;
-import jalview.api.structures.JalviewStructureDisplayI;
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.PDBEntry;
-import jalview.datamodel.SearchResultMatchI;
-import jalview.datamodel.SearchResultsI;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.gui.StructureViewer.ViewerType;
-import jalview.httpserver.AbstractRequestHandler;
-import jalview.io.DataSourceType;
-import jalview.structure.AtomSpec;
-import jalview.structure.StructureCommand;
-import jalview.structure.StructureCommandI;
-import jalview.structure.StructureSelectionManager;
-import jalview.structures.models.AAStructureBindingModel;
-
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
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.datamodel.AlignmentI;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.SearchResultMatchI;
+import jalview.datamodel.SearchResultsI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.StructureViewer.ViewerType;
+import jalview.httpserver.AbstractRequestHandler;
+import jalview.io.DataSourceType;
+import jalview.structure.AtomSpec;
+import jalview.structure.StructureCommand;
+import jalview.structure.StructureCommandI;
+import jalview.structure.StructureSelectionManager;
+import jalview.structures.models.AAStructureBindingModel;
public abstract class JalviewChimeraBinding extends AAStructureBindingModel
{
+ public static final String CHIMERA_SESSION_EXTENSION = ".py";
+
public static final String CHIMERA_FEATURE_GROUP = "Chimera";
// Chimera clause to exclude alternate locations in atom selection
* Close down the Jalview viewer and listener, and (optionally) the associated
* Chimera window.
*/
+ @Override
public void closeViewer(boolean closeChimera)
{
- getSsm().removeStructureViewerListener(this, this.getStructureFiles());
+ super.closeViewer(closeChimera);
if (closeChimera)
{
chimeraManager.exitChimera();
{
chimeraMonitor.interrupt();
}
- releaseUIResources();
}
/**
*
* @return
*/
- public boolean isChimeraRunning()
+ @Override
+ public boolean isViewerRunning()
{
return chimeraManager.isChimeraLaunched();
}
}
/**
- * Ask Chimera to save its session to the given file. Returns true if
- * successful, else false.
- *
- * @param filepath
- * @return
- */
- public boolean saveSession(String filepath)
- {
- if (isChimeraRunning())
- {
- /*
- * Chimera: https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/save.html
- * ChimeraX: https://www.cgl.ucsf.edu/chimerax/docs/user/commands/save.html
- */
- String command = getCommandGenerator().saveSession(filepath)
- .getCommand();
- List<String> reply = chimeraManager.sendChimeraCommand(command, true);
- if (reply.contains("Session written"))
- {
- return true;
- }
- else
- {
- Cache.log
- .error("Error saving Chimera session: " + reply.toString());
- }
- }
- return false;
- }
-
- /**
* Ask Chimera to open a session file. Returns true if successful, else false.
* The filename must have a .py (Chimera) or .cxs (ChimeraX) extension for
* this command to work.
}
/**
- * Returns the file extension to use for a saved viewer session file
+ * Returns the file extension to use for a saved viewer session file (.py)
*
* @return
*/
+ @Override
public String getSessionFileExtension()
{
- return ".py";
+ return CHIMERA_SESSION_EXTENSION;
}
public String getHelpURL()