JAL-2629 storage and lifecycle of alignment/group HMM annotations revised
[jalview.git] / src / jalview / gui / AnnotationLabels.java
index 3112fe1..dbf2ab1 100755 (executable)
@@ -388,6 +388,10 @@ public class AnnotationLabels extends JPanel
       pop.show(this, evt.getX(), evt.getY());
       return;
     }
+
+    final AlignmentAnnotation ann = aa[selectedRow];
+    final boolean isSequenceAnnotation = ann.sequenceRef != null;
+
     item = new JMenuItem(EDITNAME);
     item.addActionListener(this);
     pop.add(item);
@@ -397,9 +401,9 @@ public class AnnotationLabels extends JPanel
     // JAL-1264 hide all sequence-specific annotations of this type
     if (selectedRow < aa.length)
     {
-      if (aa[selectedRow].sequenceRef != null)
+      if (isSequenceAnnotation)
       {
-        final String label = aa[selectedRow].label;
+        final String label = ann.label;
         JMenuItem hideType = new JMenuItem();
         String text = MessageManager.getString("label.hide_all") + " "
                 + label;
@@ -412,15 +416,6 @@ public class AnnotationLabels extends JPanel
             AlignmentUtils.showOrHideSequenceAnnotations(
                     ap.av.getAlignment(), Collections.singleton(label),
                     null, false, false);
-            // for (AlignmentAnnotation ann : ap.av.getAlignment()
-            // .getAlignmentAnnotation())
-            // {
-            // if (ann.sequenceRef != null && ann.label != null
-            // && ann.label.equals(label))
-            // {
-            // ann.visible = false;
-            // }
-            // }
             ap.refresh(true);
           }
         });
@@ -443,397 +438,314 @@ public class AnnotationLabels extends JPanel
     // property methods
     if (selectedRow < aa.length)
     {
-      final String label = aa[selectedRow].label;
-      if (!(aa[selectedRow].autoCalculated)
-              && !(InformationThread.HMM_CALC_ID
-                      .equals(aa[selectedRow].getCalcId())))
+      final String label = ann.label;
+      if (!(ann.autoCalculated)
+              && !(InformationThread.HMM_CALC_ID.equals(ann.getCalcId())))
       {
-        if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
+        if (ann.graph == AlignmentAnnotation.NO_GRAPH)
         {
           // display formatting settings for this row.
           pop.addSeparator();
           // av and sequencegroup need to implement same interface for
           item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
-                  aa[selectedRow].scaleColLabel);
+                  ann.scaleColLabel);
           item.addActionListener(this);
           pop.add(item);
         }
       }
       else if (label.indexOf("Consensus") > -1)
       {
+        addConsensusMenu(pop, ann);
+      }
+      else if (InformationThread.HMM_CALC_ID.equals(ann.getCalcId()))
+      {
+        addHmmerMenu(pop, ann);
+      }
+    }
+    pop.show(this, evt.getX(), evt.getY());
+  }
 
-
-        pop.addSeparator();
-        // av and sequencegroup need to implement same interface for
-
-        final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
-                MessageManager.getString("label.ignore_gaps_consensus"),
-                (aa[selectedRow].groupRef != null)
-                        ? aa[selectedRow].groupRef.getIgnoreGapsConsensus()
-                        : ap.av.isIgnoreGapsConsensus());
-        final AlignmentAnnotation aaa = aa[selectedRow];
-        cbmi.addActionListener(new ActionListener()
+  /**
+   * Adds context menu options for (alignment or group) Hmmer annotation
+   * 
+   * @param pop
+   * @param ann
+   */
+  protected void addHmmerMenu(JPopupMenu pop, final AlignmentAnnotation ann)
+  {
+    final boolean isGroupAnnotation = ann.groupRef != null;
+    pop.addSeparator();
+    final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
+            MessageManager.getString(
+                    "label.ignore_below_background_frequency"),
+            isGroupAnnotation
+                    ? ann.groupRef
+                            .isIgnoreBelowBackground()
+                    : ap.av.isIgnoreBelowBackground());
+    cbmi.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        if (isGroupAnnotation)
         {
-          @Override
-          public void actionPerformed(ActionEvent e)
+          if (!ann.groupRef.isUseInfoLetterHeight())
           {
-            if (aaa.groupRef != null)
-            {
-              // TODO: pass on reference to ap so the view can be updated.
-              aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
-              ap.getAnnotationPanel()
-                      .paint(ap.getAnnotationPanel().getGraphics());
-            }
-            else
-            {
-              ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
-            }
-            ap.alignmentChanged();
+            ann.groupRef.setIgnoreBelowBackground(cbmi.getState());
           }
-        });
-        pop.add(cbmi);
-        // av and sequencegroup need to implement same interface for
-        if (aaa.groupRef != null)
+        }
+        else if (!ap.av.isInfoLetterHeight())
         {
-          final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_group_histogram"),
-                  aa[selectedRow].groupRef.isShowConsensusHistogram());
-          chist.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              aaa.groupRef.setShowConsensusHistogram(chist.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(chist);
-          final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_group_logo"),
-                  aa[selectedRow].groupRef.isShowSequenceLogo());
-          cprofl.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              aaa.groupRef.setshowSequenceLogo(cprofl.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cprofl);
-          final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.normalise_group_logo"),
-                  aa[selectedRow].groupRef.isNormaliseSequenceLogo());
-          cproflnorm.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
-              // automatically enable logo display if we're clicked
-              aaa.groupRef.setshowSequenceLogo(true);
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cproflnorm);
+          ap.av.setIgnoreBelowBackground(cbmi.getState(), ap);
+        }
+        ap.alignmentChanged();
+      }
+    });
+    pop.add(cbmi);
+    final JCheckBoxMenuItem letterHeight = new JCheckBoxMenuItem(
+            MessageManager.getString("label.use_info_for_height"),
+            isGroupAnnotation ? ann.groupRef.isUseInfoLetterHeight()
+                    : ap.av.isInfoLetterHeight());
+    letterHeight.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        if (isGroupAnnotation)
+        {
+          ann.groupRef.setInfoLetterHeight((letterHeight.getState()));
+          ann.groupRef.setIgnoreBelowBackground(true);
         }
         else
         {
-          final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_histogram"),
-                  av.isShowConsensusHistogram());
-          chist.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              av.setShowConsensusHistogram(chist.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(chist);
-          final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_logo"),
-                  av.isShowSequenceLogo());
-          cprof.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              av.setShowSequenceLogo(cprof.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cprof);
-          final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.normalise_logo"),
-                  av.isNormaliseSequenceLogo());
-          cprofnorm.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              av.setShowSequenceLogo(true);
-              av.setNormaliseSequenceLogo(cprofnorm.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cprofnorm);
+          ap.av.setInfoLetterHeight(letterHeight.getState(), ap);
+          ap.av.setIgnoreBelowBackground(true, ap);
         }
-        final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
-        consclipbrd.addActionListener(this);
-        pop.add(consclipbrd);
+        ap.alignmentChanged();
       }
-      else if (InformationThread.HMM_CALC_ID
-              .equals(aa[selectedRow].getCalcId()))
+    });
+    pop.add(letterHeight);
+    if (isGroupAnnotation)
+    {
+      final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_group_histogram"),
+              ann.groupRef.isShowInformationHistogram());
+      chist.addActionListener(new ActionListener()
       {
-        pop.addSeparator();
-        final AlignmentAnnotation aaa = aa[selectedRow];
-
-        final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
-                MessageManager.getString(
-                        "label.ignore_below_background_frequency"),
-                (aa[selectedRow].groupRef != null)
-                        ? aa[selectedRow].groupRef
-                                .getIgnoreBelowBackground()
-                        : ap.av.isIgnoreBelowBackground());
-
-        cbmi.addActionListener(new ActionListener()
+        @Override
+        public void actionPerformed(ActionEvent e)
         {
-          @Override
-          public void actionPerformed(ActionEvent e)
-          {
-
-            if (aaa.groupRef != null)
-            {
-              // TODO: pass on reference to ap so the view can be updated.
-              if (aaa.groupRef.getInfoLetterHeight() == false)
-              {
-                aaa.groupRef.setIgnoreBelowBackground(cbmi.getState());
-                ap.getAnnotationPanel()
-                        .paint(ap.getAnnotationPanel().getGraphics());
-              }
-            }
-            else if (ap.av.isInfoLetterHeight() == false)
-            {
-              ap.av.setIgnoreBelowBackground(cbmi.getState(), ap);
-            }
-            ap.alignmentChanged();
-          }
-        });
-        pop.add(cbmi);
-        final JCheckBoxMenuItem letteHeight = new JCheckBoxMenuItem(
-                MessageManager.getString("label.use_info_for_height"),
-                (aa[selectedRow].groupRef != null)
-                        ? aa[selectedRow].groupRef.getInfoLetterHeight()
-                        : ap.av.isInfoLetterHeight());
-
-        letteHeight.addActionListener(new ActionListener()
+          ann.groupRef.setShowInformationHistogram(chist.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(chist);
+      final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_group_logo"),
+              ann.groupRef.isShowHMMSequenceLogo());
+      cprofl.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
         {
-          @Override
-          public void actionPerformed(ActionEvent e)
-          {
-            if (aaa.groupRef != null)
-            {
-              // TODO: pass on reference to ap so the view can be updated.
-              aaa.groupRef.setInfoLetterHeight((letteHeight.getState()));
-              if (aaa.groupRef.getIgnoreBelowBackground() == false)
-              {
-                aaa.groupRef.setIgnoreBelowBackground(true);
-              }
-              ap.getAnnotationPanel()
-                      .paint(ap.getAnnotationPanel().getGraphics());
-            }
-            else
-            {
-              ap.av.setInfoLetterHeight(letteHeight.getState(), ap);
-              if (ap.av.isIgnoreBelowBackground() == false)
-              {
-                ap.av.setIgnoreBelowBackground(true, ap);
-              }
-            }
-            ap.alignmentChanged();
-          }
-        });
-        pop.add(letteHeight);
-        if (aaa.groupRef != null)
+          ann.groupRef.setshowHMMSequenceLogo(cprofl.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(cprofl);
+      final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+              MessageManager.getString("label.normalise_group_logo"),
+              ann.groupRef.isNormaliseHMMSequenceLogo());
+      cproflnorm.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
         {
-          final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_group_histogram"),
-                  aa[selectedRow].groupRef.isShowInformationHistogram());
-          chist.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              aaa.groupRef.setShowInformationHistogram(chist.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(chist);
-          final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_group_logo"),
-                  aa[selectedRow].groupRef.isShowHMMSequenceLogo());
-          cprofl.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              aaa.groupRef.setshowHMMSequenceLogo(cprofl.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cprofl);
-          final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.normalise_group_logo"),
-                  aa[selectedRow].groupRef.isNormaliseHMMSequenceLogo());
-          cproflnorm.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
+          ann.groupRef
+                  .setNormaliseHMMSequenceLogo(cproflnorm.getState());
+          // automatically enable logo display if we're clicked
+          ann.groupRef.setshowHMMSequenceLogo(true);
+          ap.repaint();
+        }
+      });
+      pop.add(cproflnorm);
+    }
+    else
+    {
+      final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_histogram"),
+              av.isShowInformationHistogram());
+      chist.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          av.setShowInformationHistogram(chist.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(chist);
+      final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_logo"),
+              av.isShowHMMSequenceLogo());
+      cprof.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          av.updateInformation(ap);
+          av.setShowHMMSequenceLogo(cprof.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(cprof);
+      final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
+              MessageManager.getString("label.normalise_logo"),
+              av.isNormaliseHMMSequenceLogo());
+      cprofnorm.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          av.setShowHMMSequenceLogo(true);
+          av.setNormaliseHMMSequenceLogo(cprofnorm.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(cprofnorm);
+    }
+  }
 
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              aaa.groupRef
-                      .setNormaliseHMMSequenceLogo(cproflnorm.getState());
-              // automatically enable logo display if we're clicked
-              aaa.groupRef.setshowHMMSequenceLogo(true);
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cproflnorm);
+  /**
+   * Adds context menu options for (alignment or group) Consensus annotation
+   * 
+   * @param pop
+   * @param ann
+   */
+  protected void addConsensusMenu(JPopupMenu pop,
+          final AlignmentAnnotation ann)
+  {
+    final boolean isGroupAnnotation = ann.groupRef != null;
+    pop.addSeparator();
+
+    final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
+            MessageManager.getString("label.ignore_gaps_consensus"),
+            (ann.groupRef != null)
+                    ? ann.groupRef.isIgnoreGapsConsensus()
+                    : ap.av.isIgnoreGapsConsensus());
+    cbmi.addActionListener(new ActionListener()
+    {
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        if (isGroupAnnotation)
+        {
+          ann.groupRef.setIgnoreGapsConsensus(cbmi.getState());
         }
         else
         {
-          final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_histogram"),
-                  av.isShowInformationHistogram());
-          chist.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              av.setShowInformationHistogram(chist.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(chist);
-          final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.show_logo"),
-                  av.isShowHMMSequenceLogo());
-          cprof.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              av.updateInformation(ap);
-              av.setShowHMMSequenceLogo(cprof.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cprof);
-          final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
-                  MessageManager.getString("label.normalise_logo"),
-                  av.isNormaliseHMMSequenceLogo());
-          cprofnorm.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO: pass on reference
-              // to ap
-              // so the
-              // view
-              // can be
-              // updated.
-              av.setShowHMMSequenceLogo(true);
-              av.setNormaliseHMMSequenceLogo(cprofnorm.getState());
-              ap.repaint();
-              // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
-            }
-          });
-          pop.add(cprofnorm);
+          ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
         }
+        ap.alignmentChanged();
       }
+    });
+    pop.add(cbmi);
+    if (isGroupAnnotation)
+    {
+      /*
+       * group consensus options
+       */
+      final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_group_histogram"),
+              ann.groupRef.isShowConsensusHistogram());
+      chist.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          ann.groupRef.setShowConsensusHistogram(chist.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(chist);
+      final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_group_logo"),
+              ann.groupRef.isShowSequenceLogo());
+      cprofl.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          ann.groupRef.setshowSequenceLogo(cprofl.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(cprofl);
+      final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+              MessageManager.getString("label.normalise_group_logo"),
+              ann.groupRef.isNormaliseSequenceLogo());
+      cproflnorm.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          ann.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
+          // automatically enable logo display if we're clicked
+          ann.groupRef.setshowSequenceLogo(true);
+          ap.repaint();
+        }
+      });
+      pop.add(cproflnorm);
     }
-    pop.show(this, evt.getX(), evt.getY());
+    else
+    {
+      /*
+       * alignment consensus options
+       */
+      final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_histogram"),
+              av.isShowConsensusHistogram());
+      chist.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          av.setShowConsensusHistogram(chist.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(chist);
+      final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
+              MessageManager.getString("label.show_logo"),
+              av.isShowSequenceLogo());
+      cprof.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          av.setShowSequenceLogo(cprof.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(cprof);
+      final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
+              MessageManager.getString("label.normalise_logo"),
+              av.isNormaliseSequenceLogo());
+      cprofnorm.addActionListener(new ActionListener()
+      {
+        @Override
+        public void actionPerformed(ActionEvent e)
+        {
+          av.setShowSequenceLogo(true);
+          av.setNormaliseSequenceLogo(cprofnorm.getState());
+          ap.repaint();
+        }
+      });
+      pop.add(cprofnorm);
+    }
+    final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
+    consclipbrd.addActionListener(this);
+    pop.add(consclipbrd);
   }
 
   /**
@@ -1147,7 +1059,6 @@ public class AnnotationLabels extends JPanel
             PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
             ap.av.sendSelection();
           }
-
         }
       }
       return;
@@ -1200,7 +1111,6 @@ public class AnnotationLabels extends JPanel
 
       hiddenColumns = av.getAlignment().getHiddenColumns()
               .getHiddenColumnsCopy();
-
     }
 
     Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
@@ -1220,7 +1130,6 @@ public class AnnotationLabels extends JPanel
   @Override
   public void paintComponent(Graphics g)
   {
-
     int width = getWidth();
     if (width == 0)
     {
@@ -1235,7 +1144,6 @@ public class AnnotationLabels extends JPanel
     }
 
     drawComponent(g2, true, width);
-
   }
 
   /**