label.map_sequences_to_visible_window = Map Sequences to Visible Window: {0}
label.add_pdbentry_to_view = Do you want to add {0} to the view called\n{1}\n
label.align_to_existing_structure_view = Align to existing structure view
-label.pdb_entries_couldnt_be_retrieved = The following pdb entries could not be retrieved from the PDB\:\n{0}\nPlease try downloading them manually.
+label.pdb_entries_couldnt_be_retrieved = The following pdb entries could not be retrieved from the PDB\:\n{0}\nPlease retry, or try downloading them manually.
label.couldnt_load_file = Couldn't load file
label.couldnt_find_pdb_id_in_file = Couldn't find a PDB id in the file supplied. Please enter an Id to identify this structure.
label.no_pdb_id_in_file = No PDB Id in File
label.jmol_help = Jmol Help
label.chimera_help = Chimera Help
label.close_viewer = Close Viewer
-label.confirm_close_chimera = Do you want to close the Chimera window?
+label.confirm_close_chimera = This will close Jalview''s connection to {0}.<br>Do you want to close the Chimera window as well?
label.chimera_help = Chimera Help
label.all = All
label.sort_by = Sort alignment by
}
/**
- * construct a title string for the viewer window based on the data jalview
+ * Construct a title string for the viewer window based on the data Jalview
* knows about
*
+ * @param verbose
* @return
*/
- public String getViewerTitle()
+ public String getViewerTitle(boolean verbose)
{
if (sequence == null || pdbentry == null || sequence.length < 1
|| pdbentry.length < 1 || sequence[0].length < 1)
}
// TODO: give a more informative title when multiple structures are
// displayed.
- StringBuffer title = new StringBuffer("Chimera view for "
- + sequence[0][0].getName() + ":" + pdbentry[0].getId());
+ StringBuilder title = new StringBuilder(64);
+ title.append("Chimera view for " + sequence[0][0].getName() + ":"
+ + pdbentry[0].getId());
- if (pdbentry[0].getProperty() != null)
+ if (verbose)
{
- if (pdbentry[0].getProperty().get("method") != null)
+ if (pdbentry[0].getProperty() != null)
{
- title.append(" Method: ");
- title.append(pdbentry[0].getProperty().get("method"));
- }
- if (pdbentry[0].getProperty().get("chains") != null)
- {
- title.append(" Chain:");
- title.append(pdbentry[0].getProperty().get("chains"));
+ if (pdbentry[0].getProperty().get("method") != null)
+ {
+ title.append(" Method: ");
+ title.append(pdbentry[0].getProperty().get("method"));
+ }
+ if (pdbentry[0].getProperty().get("chains") != null)
+ {
+ title.append(" Chain:");
+ title.append(pdbentry[0].getProperty().get("chains"));
+ }
}
}
return title.toString();
+ ";focus " + cmdstring, false);
}
- public void closeViewer()
+ /**
+ * Close down the Jalview viewer, and (optionally) the associate Chimera
+ * window.
+ */
+ public void closeViewer(boolean closeChimera)
{
ssm.removeStructureViewerListener(this, this.getPdbFile());
- // and shut down Chimera
- viewer.exitChimera();
+ if (closeChimera)
+ {
+ viewer.exitChimera();
+ }
// viewer.evalStringQuiet("zap");
// viewer.setJmolStatusListener(null);
lastCommand = null;
}
System.out.println("Select regions:\n" + selectioncom.toString());
allComs.append("; ~display all; chain @CA|P; ribbon "
- + selectioncom.toString() + "");
+ + selectioncom.toString() + "; focus");
// evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString());
evalStateCommand(allComs.toString(), true /* false */);
}
}
}
- public void evalStateCommand(final String command, boolean resp)
+ /**
+ * Answers true if the Chimera process is still running, false if ended or not
+ * started.
+ *
+ * @return
+ */
+ public boolean isChimeraRunning()
+ {
+ return viewer.isChimeraLaunched();
+ }
+
+ /**
+ * Send a command to Chimera, and optionally log any responses.
+ *
+ * @param command
+ * @param logResponse
+ */
+ public void evalStateCommand(final String command, boolean logResponse)
{
viewerCommandHistory(false);
checkLaunched();
// public void run()
// {
// trim command or it may never find a match in the replyLog!!
- lastReply = viewer.sendChimeraCommand(command.trim(), resp);
- if (debug && resp)
+ lastReply = viewer.sendChimeraCommand(command.trim(), logResponse);
+ if (debug && logResponse)
{
log("Response from command ('" + command + "') was:\n"
+ lastReply);
jmb.setFinishedInit(false);
// TODO: consider waiting until the structure/view is fully loaded before
// displaying
- jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(),
+ jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(true),
getBounds().width, getBounds().height);
if (command == null)
{
jmb.centerViewer(toshow);
}
+ /**
+ * Close down this instance of Jalview's Chimera viewer, giving the user the
+ * option to close the associated Chimera window (process). They may wish to
+ * keep it open until they have had an opportunity to save any work.
+ */
public void closeViewer()
{
- jmb.closeViewer();
+ if (jmb.isChimeraRunning())
+ {
+ String prompt = MessageManager
+ .formatMessage("label.confirm_close_chimera", new Object[]
+ { jmb.getViewerTitle(false) });
+ prompt = JvSwingUtils.wrapTooltip(true, prompt);
+ int confirm = JOptionPane.showConfirmDialog(this, prompt,
+ MessageManager.getString("label.close_viewer"),
+ JOptionPane.YES_NO_OPTION);
+ jmb.closeViewer(confirm == JOptionPane.YES_OPTION);
+ }
ap = null;
_aps.clear();
_alignwith.clear();
} catch (Exception ex)
{
ex.printStackTrace();
- errormsgs.append("When retrieving pdbfiles : current was: '"
+ errormsgs.append("When retrieving pdbfiles for '"
+ thePdbEntry.getId() + "'");
}
if (errormsgs.length() > 0)
} catch (OutOfMemoryError oomerror)
{
new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
- }
- if (progressBar != null)
+ } finally
{
- progressBar.setProgressBar(
- MessageManager.getString("label.state_completed"), hdl);
+ if (progressBar != null)
+ {
+ progressBar.setProgressBar(
+ MessageManager.getString("label.state_completed"), hdl);
+ }
}
/*
* If PDB data were saved and are not invalid (empty alignment), return the
}
setChainMenuItems(jmb.chainNames);
- this.setTitle(jmb.getViewerTitle());
+ this.setTitle(jmb.getViewerTitle(true));
if (jmb.getPdbFile().length > 1 && jmb.sequence.length > 1)
{
viewerActionMenu.setVisible(true);
AlignmentPanel ap = (AlignmentPanel) source, topap;
// ignore events from panels not used to colour this view
if (!cvf.isUsedforcolourby(ap))
+ {
return;
+ }
if (!isLoadingFromArchive())
{
colourBySequence(ap.av.getShowSequenceFeatures(), ap);