X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FChimeraViewFrame.java;h=cc6a785280449f17a83468c46d6d95551542ae38;hb=353cb52722490edcba2c13b18836b6d37c5455de;hp=e3c65da467fe22e84a4d8f6f11b60ed4234221e8;hpb=1f029391e9e263b132a62eaefcc2fe68badacfd6;p=jalview.git diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index e3c65da..cc6a785 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -38,7 +38,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; @@ -73,6 +73,10 @@ public class ChimeraViewFrame extends StructureViewerBase private int myHeight = 150; + private JMenuItem writeFeatures = null; + + private JMenu fetchAttributes = null; + /** * Initialise menu options. */ @@ -84,10 +88,10 @@ public class ChimeraViewFrame extends StructureViewerBase savemenu.setVisible(false); // not yet implemented viewMenu.add(fitToWindow); - JMenuItem writeFeatures = new JMenuItem( + 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 @@ -98,10 +102,10 @@ public class ChimeraViewFrame extends StructureViewerBase }); viewerActionMenu.add(writeFeatures); - final JMenu fetchAttributes = new JMenu( - MessageManager.getString("label.fetch_chimera_attributes")); - fetchAttributes.setToolTipText( - MessageManager.getString("label.fetch_chimera_attributes_tip")); + fetchAttributes = new JMenu(MessageManager.formatMessage( + "label.fetch_viewer_attributes", getViewerName())); + fetchAttributes.setToolTipText(MessageManager.formatMessage( + "label.fetch_viewer_attributes_tip", getViewerName())); fetchAttributes.addMouseListener(new MouseAdapter() { @@ -114,6 +118,16 @@ public class ChimeraViewFrame extends StructureViewerBase viewerActionMenu.add(fetchAttributes); } + @Override + protected void buildActionMenu() + { + super.buildActionMenu(); + // 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 @@ -152,8 +166,8 @@ public class ChimeraViewFrame extends StructureViewerBase { // todo pull up? int count = jmb.sendFeaturesToViewer(getAlignmentPanel()); - statusBar.setText( - MessageManager.formatMessage("label.attributes_set", count)); + statusBar.setText(MessageManager.formatMessage("label.attributes_set", + count, getViewerName())); } /** @@ -280,8 +294,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); @@ -320,6 +333,7 @@ public class ChimeraViewFrame extends StructureViewerBase getViewerName()), MessageManager.getString("label.error_loading_file"), JvOptionPane.ERROR_MESSAGE); + jmb.closeViewer(true); this.dispose(); return; } @@ -430,9 +444,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) { @@ -475,12 +495,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); } } }