X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=d07a7c27e42fdc5fd537f532d87505a48a74655b;hb=6d882bd2c72c5fe9e8d0a8eb9df4de7a86bbc773;hp=89de2e83cdd9d88c0ad45f7b93be06832f408c3a;hpb=04a92acb1e484730552d42fdf2d356e04551c5ea;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 89de2e8..d07a7c2 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -100,41 +100,34 @@ public class ChimeraViewFrame extends StructureViewerBase 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); } /** @@ -202,7 +195,7 @@ public class ChimeraViewFrame extends StructureViewerBase } /** - * 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 @@ -213,30 +206,7 @@ public class ChimeraViewFrame extends StructureViewerBase 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 }); @@ -264,7 +234,6 @@ public class ChimeraViewFrame extends StructureViewerBase if (pdbentrys.length > 1) { - alignAddedStructures = true; useAlignmentPanelForSuperposition(ap); } jmb.setColourBySequence(true); @@ -323,17 +292,19 @@ public class ChimeraViewFrame extends StructureViewerBase } /** - * 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); } @@ -352,29 +323,6 @@ public class ChimeraViewFrame extends StructureViewerBase } /** - * 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 getViewersFor(AlignmentPanel ap) - { - List result = new ArrayList<>(); - 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. */ @@ -641,7 +589,7 @@ public class ChimeraViewFrame extends StructureViewerBase jmb.updateColours(ap); } // do superposition if asked to - if (Cache.getDefault("AUTOSUPERIMPOSE", true) && alignAddedStructures) + if (alignAddedStructures) { new Thread(new Runnable() { @@ -651,7 +599,6 @@ public class ChimeraViewFrame extends StructureViewerBase alignStructs_withAllAlignPanels(); } }).start(); - alignAddedStructures = false; } addingStructures = false; } @@ -681,7 +628,6 @@ public class ChimeraViewFrame extends StructureViewerBase 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;