import jalview.datamodel.SequenceI;
import jalview.gui.StructureViewer.ViewerType;
import jalview.gui.ViewSelectionMenu.ViewSetProvider;
-import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
import jalview.jbgui.GStructureViewer;
+import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
/**
* Base class with common functionality for JMol, Chimera or other structure
*
* @param pdbId
* @param view
- * @return YES, NO or CANCEL JOptionPane code
+ * @return YES, NO or CANCEL JvOptionPane code
*/
protected int chooseAlignStructureToViewer(String pdbId,
StructureViewerBase view)
{
- int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ int option = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
MessageManager.formatMessage("label.add_pdbentry_to_view",
new Object[] { pdbId, view.getTitle() }),
MessageManager
.getString("label.align_to_existing_structure_view"),
- JOptionPane.YES_NO_CANCEL_OPTION);
+ JvOptionPane.YES_NO_CANCEL_OPTION);
return option;
}
protected abstract boolean hasPdbId(String pdbId);
- protected abstract List<StructureViewerBase> getViewersFor(
- AlignmentPanel alp);
+ /**
+ * Returns a list of any structure viewers of the same type. The list is
+ * restricted to those linked to the given alignment panel if it is not null.
+ */
+ protected List<StructureViewerBase> getViewersFor(AlignmentPanel alp){
+
+ List<StructureViewerBase> result = new ArrayList<StructureViewerBase>();
+ JInternalFrame[] frames = Desktop.instance.getAllFrames();
+
+ for (JInternalFrame frame : frames)
+ {
+ if (this.getClass().isAssignableFrom(frame.getClass()))
+ {
+ if (alp == null
+ || ((StructureViewerBase) frame).isLinkedWith(alp))
+ {
+ result.add((StructureViewerBase) frame);
+ }
+ }
+ }
+ return result;
+
+ }
/**
* Check for any existing views involving this alignment and give user the
continue;
}
int option = chooseAlignStructureToViewer(pdbId, view);
- if (option == JOptionPane.CANCEL_OPTION)
+ if (option == JvOptionPane.CANCEL_OPTION)
{
return true;
}
- else if (option == JOptionPane.YES_OPTION)
+ else if (option == JvOptionPane.YES_OPTION)
{
view.useAlignmentPanelForSuperposition(apanel);
view.addStructure(pdbentry, seq, chains, true, apanel.alignFrame);
* create the mappings
*/
apanel.getStructureSelectionManager().setMapping(seq, chains,
- pdbFilename, AppletFormatAdapter.FILE);
+ pdbFilename, DataSourceType.FILE);
/*
* alert the FeatureRenderer to show new (PDB RESNUM) features
final AlignmentPanel apanel, String pdbId)
{
boolean finished = false;
- String alreadyMapped = apanel.getStructureSelectionManager()
- .alreadyMappedToFile(pdbId);
+ StructureSelectionManager ssm = apanel.getStructureSelectionManager();
+ String alreadyMapped = ssm.alreadyMappedToFile(pdbId);
if (alreadyMapped != null)
{
/*
* the PDB file is already loaded
*/
- int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ int option = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
MessageManager.formatMessage(
"label.pdb_entry_is_already_displayed",
new Object[] { pdbId }), MessageManager
.formatMessage(
"label.map_sequences_to_visible_window",
new Object[] { pdbId }),
- JOptionPane.YES_NO_CANCEL_OPTION);
- if (option == JOptionPane.CANCEL_OPTION)
+ JvOptionPane.YES_NO_CANCEL_OPTION);
+ if (option == JvOptionPane.CANCEL_OPTION)
{
finished = true;
}
- else if (option == JOptionPane.YES_OPTION)
+ else if (option == JvOptionPane.YES_OPTION)
{
addSequenceMappingsToStructure(seq, chains, apanel, alreadyMapped);
finished = true;