X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=62e7b38662e6b8874f92663fe91cc35c8bdfdae1;hb=747167089ecf8d6afc70d417f5a20352e029bd95;hp=8dd0174762e1196173289816595832a89558e357;hpb=da8ae730f171f46648872305c3690a980967ffcc;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 8dd0174..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; @@ -38,7 +39,7 @@ import javax.swing.event.InternalFrameEvent; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; -import jalview.bin.Cache; +import jalview.bin.Console; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.datamodel.StructureViewerModel; @@ -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() }), @@ -441,9 +445,15 @@ public class ChimeraViewFrame extends StructureViewerBase initChimera(); } catch (Exception ex) { - Cache.log.error("Couldn't open Chimera viewer!", ex); + 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) { @@ -486,12 +496,12 @@ public class ChimeraViewFrame extends StructureViewerBase oomerror); } catch (Exception ex) { - Cache.log.error( + Console.error( "Couldn't open " + pe.getFile() + " in Chimera viewer!", ex); } finally { - Cache.log.debug("File locations are " + files); + Console.debug("File locations are " + files); } } } @@ -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() {