JAL-2416 add score model description field for tooltip in PCA panel
[jalview.git] / src / jalview / gui / PCAPanel.java
index 3b73c5a..885c3bf 100644 (file)
@@ -195,10 +195,19 @@ public class PCAPanel extends GPCAPanel implements Runnable,
     for (final ScoreModelI sm : ScoreModels.getInstance().getModels())
     {
       final String name = sm.getName();
-      // create an entry for this score matrix for use in PCA
-      JCheckBoxMenuItem jm = new JCheckBoxMenuItem();
-      jm.setText(MessageManager.getStringOrReturn("label.score_model_",
-              name));
+      JCheckBoxMenuItem jm = new JCheckBoxMenuItem(name);
+
+      /*
+       * if the score model doesn't provide a description, try to look one
+       * up in the text bundle, falling back on its name
+       */
+      String tooltip = sm.getDescription();
+      if (tooltip == null)
+      {
+        tooltip = MessageManager.getStringOrReturn("label.score_model_",
+                name);
+      }
+      jm.setToolTipText(tooltip);
       jm.setSelected(pcaModel.getScoreModelName().equals(name));
       if ((pcaModel.isNucleotide() && sm.isDNA())
               || (!pcaModel.isNucleotide() && sm.isProtein()))