JAL-1485 JAL-1483 show i18n key for different available score models, and limit to...
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 21 Apr 2014 16:26:52 +0000 (17:26 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 21 Apr 2014 16:26:52 +0000 (17:26 +0100)
src/jalview/gui/PCAPanel.java

index fc32e54..38fd74d 100644 (file)
@@ -115,26 +115,29 @@ public class PCAPanel extends GPCAPanel implements Runnable,
   protected void scoreMatrix_menuSelected()
   {
     scoreMatrixMenu.removeAll();
-    for (final Object sm:ResidueProperties.scoreMatrices.keySet())
+    for (final String sm:ResidueProperties.scoreMatrices.keySet())
     {
-      JMenuItem jm=new JMenuItem();
-      jm.setText((String)sm);
-      jm.setSelected(pcaModel.getScore_matrix().equals((String)sm));
-      final PCAPanel us = this;
-      jm.addActionListener(new ActionListener()
+      JCheckBoxMenuItem jm=new JCheckBoxMenuItem();
+      jm.setText(MessageManager.getStringOrReturn("label.score_model", sm));
+      jm.setSelected(pcaModel.getScore_matrix().equals(sm));
+      if (pcaModel.isNucleotide()==ResidueProperties.scoreMatrices.get(sm).isDNA())
       {
-        @Override
-        public void actionPerformed(ActionEvent e)
+        final PCAPanel us = this;
+        jm.addActionListener(new ActionListener()
         {
-          if (!pcaModel.getScore_matrix().equals((String)sm))
+          @Override
+          public void actionPerformed(ActionEvent e)
           {
-            pcaModel.setScore_matrix((String) sm);
-            Thread worker = new Thread(us);
-            worker.start();
+            if (!pcaModel.getScore_matrix().equals((String) sm))
+            {
+              pcaModel.setScore_matrix((String) sm);
+              Thread worker = new Thread(us);
+              worker.start();
+            }
           }
-        }
-      });
-      scoreMatrixMenu.add(jm);   
+        });
+        scoreMatrixMenu.add(jm);
+      }
     }
   }
   public void bgcolour_actionPerformed(ActionEvent e)