savemenu.setVisible(false); // not yet implemented
viewMenu.add(fitToWindow);
- /*
- * exchange of Jalview features and Chimera attributes is for now
- * an optionally enabled experimental feature
- */
- if (Desktop.instance.showExperimental())
+ JMenuItem writeFeatures = new JMenuItem(
+ MessageManager.getString("label.create_chimera_attributes"));
+ writeFeatures.setToolTipText(MessageManager
+ .getString("label.create_chimera_attributes_tip"));
+ writeFeatures.addActionListener(new ActionListener()
{
- JMenuItem writeFeatures = new JMenuItem(
- MessageManager.getString("label.create_chimera_attributes"));
- writeFeatures.setToolTipText(MessageManager
- .getString("label.create_chimera_attributes_tip"));
- writeFeatures.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- sendFeaturesToChimera();
- }
- });
- viewerActionMenu.add(writeFeatures);
-
- final JMenu fetchAttributes = new JMenu(
- MessageManager.getString("label.fetch_chimera_attributes"));
- fetchAttributes.setToolTipText(MessageManager
- .getString("label.fetch_chimera_attributes_tip"));
- fetchAttributes.addMouseListener(new MouseAdapter()
+ @Override
+ public void actionPerformed(ActionEvent e)
{
+ sendFeaturesToChimera();
+ }
+ });
+ viewerActionMenu.add(writeFeatures);
- @Override
- public void mouseEntered(MouseEvent e)
- {
- buildAttributesMenu(fetchAttributes);
- }
- });
- viewerActionMenu.add(fetchAttributes);
- }
+ final JMenu fetchAttributes = new JMenu(
+ MessageManager.getString("label.fetch_chimera_attributes"));
+ fetchAttributes.setToolTipText(
+ MessageManager.getString("label.fetch_chimera_attributes_tip"));
+ fetchAttributes.addMouseListener(new MouseAdapter()
+ {
+
+ @Override
+ public void mouseEntered(MouseEvent e)
+ {
+ buildAttributesMenu(fetchAttributes);
+ }
+ });
+ viewerActionMenu.add(fetchAttributes);
}
/**
}
/**
- * add a single PDB structure to a new or existing Chimera view
+ * open a single PDB structure in a new Chimera view
*
* @param pdbentry
* @param seq
String[] chains, final AlignmentPanel ap)
{
this();
- String pdbId = pdbentry.getId();
-
- /*
- * If the PDB file is already loaded, the user may just choose to add to an
- * existing viewer (or cancel)
- */
- if (addAlreadyLoadedFile(seq, chains, ap, pdbId))
- {
- return;
- }
-
- /*
- * Check if there are other Chimera views involving this alignment and give
- * user the option to add and align this molecule to one of them (or cancel)
- */
- if (addToExistingViewer(pdbentry, seq, chains, ap, pdbId))
- {
- return;
- }
- /*
- * If the options above are declined or do not apply, show the structure in
- * a new viewer
- */
openNewChimera(ap, new PDBEntry[] { pdbentry },
new SequenceI[][]
{ seq });
if (pdbentrys.length > 1)
{
- alignAddedStructures = true;
useAlignmentPanelForSuperposition(ap);
}
jmb.setColourBySequence(true);
}
/**
- * create a new viewer containing several structures superimposed using the
- * given alignPanel.
+ * create a new viewer containing several structures, optionally superimposed
+ * using the given alignPanel.
*
* @param pe
* @param seqs
* @param ap
*/
- public ChimeraViewFrame(PDBEntry[] pe, SequenceI[][] seqs,
+ public ChimeraViewFrame(PDBEntry[] pe, boolean alignAdded,
+ SequenceI[][] seqs,
AlignmentPanel ap)
{
this();
+ setAlignAddedStructures(alignAdded);
openNewChimera(ap, pe, seqs);
}
}
/**
- * Returns a list of any Chimera viewers in the desktop. The list is
- * restricted to those linked to the given alignment panel if it is not null.
- */
- @Override
- protected List<StructureViewerBase> getViewersFor(AlignmentPanel ap)
- {
- List<StructureViewerBase> result = new ArrayList<StructureViewerBase>();
- JInternalFrame[] frames = Desktop.instance.getAllFrames();
-
- for (JInternalFrame frame : frames)
- {
- if (frame instanceof ChimeraViewFrame)
- {
- if (ap == null || ((StructureViewerBase) frame).isLinkedWith(ap))
- {
- result.add((StructureViewerBase) frame);
- }
- }
- }
- return result;
- }
-
- /**
* Launch Chimera. If we have a chimera session file name, send Chimera the
* command to open its saved session file.
*/
@Override
void showSelectedChains()
{
- List<String> toshow = new ArrayList<String>();
+ List<String> toshow = new ArrayList<>();
for (int i = 0; i < chainMenu.getItemCount(); i++)
{
if (chainMenu.getItem(i) instanceof JCheckBoxMenuItem)
// todo - record which pdbids were successfully imported.
StringBuilder errormsgs = new StringBuilder(128);
StringBuilder files = new StringBuilder(128);
- List<PDBEntry> filePDB = new ArrayList<PDBEntry>();
- List<Integer> filePDBpos = new ArrayList<Integer>();
+ List<PDBEntry> filePDB = new ArrayList<>();
+ List<Integer> filePDBpos = new ArrayList<>();
PDBEntry thePdbEntry = null;
StructureFile pdb = null;
try
stopProgressBar("", startTime);
}
// Explicitly map to the filename used by Chimera ;
+
pdb = jmb.getSsm().setMapping(jmb.getSequence()[pos],
- jmb.getChains()[pos], pe.getFile(), protocol);
+ jmb.getChains()[pos], pe.getFile(), protocol,
+ progressBar);
stashFoundChains(pdb, pe.getFile());
+
} catch (OutOfMemoryError oomerror)
{
new OOMWarning(
jmb.updateColours(ap);
}
// do superposition if asked to
- if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures)
+ if (alignAddedStructures)
{
new Thread(new Runnable()
{
alignStructs_withAllAlignPanels();
}
}).start();
- alignAddedStructures = false;
}
addingStructures = false;
}
/**
* Fetch PDB data and save to a local file. Returns the full path to the file,
- * or null if fetch fails.
+ * or null if fetch fails. TODO: refactor to common with Jmol ? duplication
*
* @param processingEntry
* @return
private String fetchPdbFile(PDBEntry processingEntry) throws Exception
{
- // FIXME: this is duplicated code with Jmol frame ?
String filePath = null;
Pdb pdbclient = new Pdb();
AlignmentI pdbseq = null;
}
return reply;
}
+
+ @Override
+ protected IProgressIndicator getIProgressIndicator()
+ {
+ return progressBar;
+ }
}