JAL-2629 select HMM selects sequence under cursor
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Mar 2018 09:35:51 +0000 (10:35 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 30 Mar 2018 09:35:51 +0000 (10:35 +0100)
src/jalview/gui/PopupMenu.java

index c988b59..e3becf6 100644 (file)
@@ -366,17 +366,15 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
         selectHMM.setText(MessageManager.getString("label.select_hmm"));
         selectHMM.addActionListener(new ActionListener()
         {
-
           @Override
           public void actionPerformed(ActionEvent e)
           {
-            selectHMM_actionPerformed(e);
+            selectHMM_actionPerformed(sequence);
           }
         });
         add(selectHMM);
       }
 
-
       if (alignPanel.av.getSelectionGroup() != null
               && alignPanel.av.getSelectionGroup().getSize() > 1)
       {
@@ -1370,11 +1368,13 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
     jMenu1.add(displayNonconserved);
   }
 
-
-  protected void selectHMM_actionPerformed(ActionEvent e)
+  protected void selectHMM_actionPerformed(SequenceI seq)
   {
-    SequenceI hmm = ap.av.getSequenceSelection()[0];
-    ap.alignFrame.setSelectedHMMSequence(hmm);
+    // TODO move this to Viewport
+    if (seq.isHMMConsensusSequence())
+    {
+      ap.alignFrame.setSelectedHMMSequence(seq);
+    }
   }
 
   /**