JAL-1667 updated test and internationalization messages
[jalview.git] / src / jalview / gui / PopupMenu.java
index b300f5d..0a40af7 100644 (file)
@@ -212,7 +212,7 @@ public class PopupMenu extends JPopupMenu
 
   JMenu jMenu1 = new JMenu();
 
-  JMenu structureMenu = new JMenu();
+  JMenuItem structureMenu = new JMenuItem();
 
   JMenu viewStructureMenu = new JMenu();
 
@@ -639,50 +639,50 @@ public class PopupMenu extends JPopupMenu
                 new PDBEntry[pdbe.size()]), pr = reppdb.values().toArray(
                 new PDBEntry[reppdb.size()]);
         final JMenuItem gpdbview, rpdbview;
-        if (pdbe.size() == 1)
-        {
-          structureMenu.add(gpdbview = new JMenuItem(MessageManager
-                  .formatMessage("label.view_structure_for", new String[]
-                  { sqass.getDisplayId(false) })));
-        }
-        else
-        {
-          structureMenu.add(gpdbview = new JMenuItem(MessageManager
-                  .formatMessage("label.view_all_structures", new String[]
-                  { new Integer(pdbe.size()).toString() })));
-        }
-        gpdbview.setToolTipText(MessageManager
-                .getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment"));
-        gpdbview.addActionListener(new ActionListener()
-        {
-
-          @Override
-          public void actionPerformed(ActionEvent e)
-          {
-            new StructureViewer(ap.getStructureSelectionManager())
-                    .viewStructures(ap, pe, ap.av.collateForPDB(pe));
-          }
-        });
-        if (reppdb.size() > 1 && reppdb.size() < pdbe.size())
-        {
-          structureMenu.add(rpdbview = new JMenuItem(MessageManager
-                  .formatMessage(
-                          "label.view_all_representative_structures",
-                          new String[]
-                          { new Integer(reppdb.size()).toString() })));
-          rpdbview.setToolTipText(MessageManager
-                  .getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment"));
-          rpdbview.addActionListener(new ActionListener()
-          {
-
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              new StructureViewer(ap.getStructureSelectionManager())
-                      .viewStructures(ap, pr, ap.av.collateForPDB(pr));
-            }
-          });
-        }
+        // if (pdbe.size() == 1)
+        // {
+        // structureMenu.add(gpdbview = new JMenuItem(MessageManager
+        // .formatMessage("label.view_structure_for", new String[]
+        // { sqass.getDisplayId(false) })));
+        // }
+        // else
+        // {
+        // structureMenu.add(gpdbview = new JMenuItem(MessageManager
+        // .formatMessage("label.view_all_structures", new String[]
+        // { new Integer(pdbe.size()).toString() })));
+        // }
+        // gpdbview.setToolTipText(MessageManager
+        // .getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment"));
+        // gpdbview.addActionListener(new ActionListener()
+        // {
+        //
+        // @Override
+        // public void actionPerformed(ActionEvent e)
+        // {
+        // new StructureViewer(ap.getStructureSelectionManager())
+        // .viewStructures(ap, pe, ap.av.collateForPDB(pe));
+        // }
+        // });
+        // if (reppdb.size() > 1 && reppdb.size() < pdbe.size())
+        // {
+        // structureMenu.add(rpdbview = new JMenuItem(MessageManager
+        // .formatMessage(
+        // "label.view_all_representative_structures",
+        // new String[]
+        // { new Integer(reppdb.size()).toString() })));
+        // rpdbview.setToolTipText(MessageManager
+        // .getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment"));
+        // rpdbview.addActionListener(new ActionListener()
+        // {
+        //
+        // @Override
+        // public void actionPerformed(ActionEvent e)
+        // {
+        // new StructureViewer(ap.getStructureSelectionManager())
+        // .viewStructures(ap, pr, ap.av.collateForPDB(pr));
+        // }
+        // });
+        // }
       }
     }
     else
@@ -1502,7 +1502,23 @@ public class PopupMenu extends JPopupMenu
       }
     });
     jMenu1.setText(MessageManager.getString("label.group"));
-    structureMenu.setText(MessageManager.getString("label.structure"));
+    // structureMenu.setText(MessageManager.getString("label.structure"));
+    structureMenu.setText(MessageManager.getString("label.view_structure"));
+    structureMenu.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent actionEvent)
+      {
+        SequenceI[] selectedSeqs = new SequenceI[]
+        { sequence };
+        if (ap.av.getSelectionGroup() != null)
+        {
+          selectedSeqs = ap.av.getSequenceSelection();
+        }
+        new StructureChooser(selectedSeqs, sequence, ap);
+      }
+    });
+
     viewStructureMenu.setText(MessageManager
             .getString("label.view_structure"));
     // colStructureMenu.setText("Colour By Structure");
@@ -1516,7 +1532,8 @@ public class PopupMenu extends JPopupMenu
         editSequence_actionPerformed(actionEvent);
       }
     });
-    makeReferenceSeq.setText("Mark as representative");
+    makeReferenceSeq.setText(MessageManager
+            .getString("label.mark_as_representative"));
     makeReferenceSeq.addActionListener(new ActionListener()
     {
       
@@ -1639,8 +1656,8 @@ public class PopupMenu extends JPopupMenu
     jMenu1.add(showColourText);
     jMenu1.add(outline);
     jMenu1.add(displayNonconserved);
-    structureMenu.add(pdbMenu);
-    structureMenu.add(viewStructureMenu);
+    // structureMenu.add(pdbMenu);
+    // structureMenu.add(viewStructureMenu);
     // structureMenu.add(colStructureMenu);
     noColourmenuItem.setText(MessageManager.getString("label.none"));
     noColourmenuItem.addActionListener(new java.awt.event.ActionListener()
@@ -1946,28 +1963,29 @@ public class PopupMenu extends JPopupMenu
     }
     refresh();
   }
-protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
-{
-  if (!ap.av.getAlignment().hasSeqrep())
-  {
-    // initialise the display flags so the user sees something happen
-    ap.av.setDisplayReferenceSeq(true);
-    ap.av.setColourByReferenceSeq(true);
-    ap.av.getAlignment().setSeqrep(sequence);
-  }
-  else
+
+  protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
   {
-    if (ap.av.getAlignment().getSeqrep() == sequence)
+    if (!ap.av.getAlignment().hasSeqrep())
     {
-      ap.av.getAlignment().setSeqrep(null);
+      // initialise the display flags so the user sees something happen
+      ap.av.setDisplayReferenceSeq(true);
+      ap.av.setColourByReferenceSeq(true);
+      ap.av.getAlignment().setSeqrep(sequence);
     }
     else
     {
-      ap.av.getAlignment().setSeqrep(sequence);
+      if (ap.av.getAlignment().getSeqrep() == sequence)
+      {
+        ap.av.getAlignment().setSeqrep(null);
+      }
+      else
+      {
+        ap.av.getAlignment().setSeqrep(sequence);
+      }
     }
+    refresh();
   }
-  refresh();
-}
 
   protected void hideInsertions_actionPerformed(ActionEvent actionEvent)
   {
@@ -2021,10 +2039,10 @@ protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
     }
     cap.setText("<html>" + contents.toString() + "</html>");
 
-    Desktop.instance.addInternalFrame(cap, MessageManager.formatMessage(
-            "label.sequece_details_for",
-            (sequences.length == 1 ? new String[]
-            { sequences[0].getDisplayId(true) } : new String[]
+    Desktop.addInternalFrame(cap, MessageManager.formatMessage(
+            "label.sequence_details_for",
+            (sequences.length == 1 ? new Object[]
+            { sequences[0].getDisplayId(true) } : new Object[]
             { MessageManager.getString("label.selection") })), 500, 400);
 
   }