- // or we simply trust the user wants
- // wysiwig behaviour
- SequenceGroup sg = ap.av.getSelectionGroup();
- ColumnSelection csel = new ColumnSelection(ap.av.getColumnSelection());
- omitHidden = ap.av.getViewAsString(true);
- Alignment oal = new Alignment(ap.av.getSequenceSelection());
- AlignmentAnnotation[] nala = ap.av.alignment.getAlignmentAnnotation();
- for (int i = 0; i < nala.length; i++)
- {
- AlignmentAnnotation na = nala[i];
- oal.addAnnotation(na);
- }
- cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
- oal, omitHidden, csel, sg));
- oal = null;
- }
-
- public void pdbFromFile_actionPerformed()
- {
- jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
- chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle("Select a PDB file");
- chooser.setToolTipText("Load a PDB file");
-
- int value = chooser.showOpenDialog(null);
-
- if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
- {
- PDBEntry entry = new PDBEntry();
- String choice = chooser.getSelectedFile().getPath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
- try
- {
- MCview.PDBfile pdbfile = new MCview.PDBfile(choice,
- jalview.io.AppletFormatAdapter.FILE);
-
- if (pdbfile.id == null)
- {
- String reply = JOptionPane
- .showInternalInputDialog(
- Desktop.desktop,
- "Couldn't find a PDB id in the file supplied."
- + "Please enter an Id to identify this structure.",
- "No PDB Id in File", JOptionPane.QUESTION_MESSAGE);
- if (reply == null)
- {
- return;
- }
-
- entry.setId(reply);
- }
- else
- {
- entry.setId(pdbfile.id);
- }
- } catch (java.io.IOException ex)
- {
- ex.printStackTrace();
- }
-
- entry.setFile(choice);
- sequence.getDatasetSequence().addPDBId(entry);
- }
-
- }
-
- public void enterPDB_actionPerformed()
- {
- String id = JOptionPane.showInternalInputDialog(Desktop.desktop,
- "Enter PDB Id", "Enter PDB Id", JOptionPane.QUESTION_MESSAGE);
-
- if (id != null && id.length() > 0)
- {
- PDBEntry entry = new PDBEntry();
- entry.setId(id.toUpperCase());
- sequence.getDatasetSequence().addPDBId(entry);
- }
- }
-
- public void discoverPDB_actionPerformed()
- {
-
- final SequenceI[] sequences = ((ap.av.selectionGroup == null) ? new Sequence[]
- { sequence }
- : ap.av.selectionGroup.getSequencesInOrder(ap.av.alignment));
- Thread discpdb = new Thread(new Runnable()
- {
- public void run()
- {
-
- new jalview.ws.DBRefFetcher(sequences, ap.alignFrame)
- .fetchDBRefs(false);
- }