X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=62e7b38662e6b8874f92663fe91cc35c8bdfdae1;hb=96d1dabfb3cf7a879ef9f1b3bfce3d2fe8c46954;hp=9d98585289c510d3a7b0c9fae11cd62a431e2c55;hpb=cb8e52fbbc5f725e3f7f48c672cdddb0690bd978;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 9d98585..62e7b38 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -20,6 +20,7 @@ */ package jalview.gui; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -51,7 +52,6 @@ import jalview.structures.models.AAStructureBindingModel; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; import jalview.util.Platform; - /** * GUI elements for handling an external chimera display * @@ -62,6 +62,7 @@ public class ChimeraViewFrame extends StructureViewerBase { private JalviewChimeraBinding jmb; + /* * Path to Chimera session file. This is set when an open Jalview/Chimera * session is saved, or on restore from a Jalview project (if it holds the @@ -69,14 +70,16 @@ public class ChimeraViewFrame extends StructureViewerBase */ private String chimeraSessionFile = null; + private int myWidth = 500; private int myHeight = 150; - private JMenuItem writeFeatures=null; + private JMenuItem writeFeatures = null; - private JMenu fetchAttributes=null; -/** + private JMenu fetchAttributes = null; + + /** * Initialise menu options. */ @Override @@ -89,8 +92,8 @@ public class ChimeraViewFrame extends StructureViewerBase writeFeatures = new JMenuItem( MessageManager.getString("label.create_viewer_attributes")); - writeFeatures.setToolTipText(MessageManager - .getString("label.create_viewer_attributes_tip")); + writeFeatures.setToolTipText( + MessageManager.getString("label.create_viewer_attributes_tip")); writeFeatures.addActionListener(new ActionListener() { @Override @@ -101,10 +104,10 @@ public class ChimeraViewFrame extends StructureViewerBase }); viewerActionMenu.add(writeFeatures); - fetchAttributes = new JMenu( - MessageManager.formatMessage("label.fetch_viewer_attributes",getViewerName())); - fetchAttributes.setToolTipText( - MessageManager.formatMessage("label.fetch_viewer_attributes_tip",getViewerName())); + fetchAttributes = new JMenu(MessageManager.formatMessage( + "label.fetch_viewer_attributes", getViewerName())); + fetchAttributes.setToolTipText(MessageManager.formatMessage( + "label.fetch_viewer_attributes_tip", getViewerName())); fetchAttributes.addMouseListener(new MouseAdapter() { @@ -116,6 +119,7 @@ public class ChimeraViewFrame extends StructureViewerBase }); viewerActionMenu.add(fetchAttributes); } + @Override protected void buildActionMenu() { @@ -123,8 +127,9 @@ public class ChimeraViewFrame extends StructureViewerBase // add these back in after menu is refreshed viewerActionMenu.add(writeFeatures); viewerActionMenu.add(fetchAttributes); - + }; + /** * Query the structure viewer for its residue attribute names and add them as * items off the attributes menu @@ -163,8 +168,8 @@ public class ChimeraViewFrame extends StructureViewerBase { // todo pull up? int count = jmb.sendFeaturesToViewer(getAlignmentPanel()); - statusBar.setText( - MessageManager.formatMessage("label.attributes_set", count, getViewerName())); + statusBar.setText(MessageManager.formatMessage("label.attributes_set", + count, getViewerName())); } /** @@ -234,7 +239,6 @@ public class ChimeraViewFrame extends StructureViewerBase return new JalviewChimeraBindingModel(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null); } - /** * Create a new viewer from saved session state data including Chimera session * file @@ -291,8 +295,7 @@ public class ChimeraViewFrame extends StructureViewerBase * @param ap */ public ChimeraViewFrame(PDBEntry[] pe, boolean alignAdded, - SequenceI[][] seqs, - AlignmentPanel ap) + SequenceI[][] seqs, AlignmentPanel ap) { this(); setAlignAddedStructures(alignAdded); @@ -326,11 +329,12 @@ public class ChimeraViewFrame extends StructureViewerBase if (!jmb.launchChimera()) { - JvOptionPane.showMessageDialog(Desktop.desktop, + JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), MessageManager.formatMessage("label.open_viewer_failed", getViewerName()), MessageManager.getString("label.error_loading_file"), JvOptionPane.ERROR_MESSAGE); + jmb.closeViewer(true); this.dispose(); return; } @@ -423,7 +427,7 @@ public class ChimeraViewFrame extends StructureViewerBase if (errormsgs.length() > 0) { - JvOptionPane.showInternalMessageDialog(Desktop.desktop, + JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), MessageManager.formatMessage( "label.pdb_entries_couldnt_be_retrieved", new Object[] { errormsgs.toString() }), @@ -444,6 +448,12 @@ public class ChimeraViewFrame extends StructureViewerBase Console.error("Couldn't open Chimera viewer!", ex); } } + if (!jmb.isViewerRunning()) + { + // nothing to do + // TODO: ensure we tidy up JAL-3619 + return; + } int num = -1; for (PDBEntry pe : filePDB) { @@ -534,6 +544,7 @@ public class ChimeraViewFrame extends StructureViewerBase worker = null; } + @Override public void makePDBImage(TYPE imageType) { @@ -547,6 +558,7 @@ public class ChimeraViewFrame extends StructureViewerBase return jmb; } + @Override public ViewerType getViewerType() {