Add show all hidden menu
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 May 2007 07:13:53 +0000 (07:13 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 May 2007 07:13:53 +0000 (07:13 +0000)
src/jalview/gui/AnnotationLabels.java

index 0faa8b0..c0b8022 100755 (executable)
@@ -403,20 +403,19 @@ public class AnnotationLabels
 
     AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
 
+    JPopupMenu pop = new JPopupMenu("Annotations");
+    JMenuItem item = new JMenuItem(ADDNEW);
+    item.addActionListener(this);
+
     if ( (aa == null) || (aa.length == 0))
     {
-      JPopupMenu pop = new JPopupMenu("Annotations");
-      JMenuItem item = new JMenuItem(ADDNEW);
+      item = new JMenuItem(SHOWALL);
       item.addActionListener(this);
       pop.add(item);
       pop.show(this, evt.getX(), evt.getY());
-
       return;
     }
 
-    JPopupMenu pop = new JPopupMenu("Annotations");
-    JMenuItem item = new JMenuItem(ADDNEW);
-    item.addActionListener(this);
     pop.add(item);
     item = new JMenuItem(EDITNAME);
     item.addActionListener(this);
@@ -434,7 +433,7 @@ public class AnnotationLabels
     item.addActionListener(this);
     pop.add(item);
     // annotation object should be typed
-    if (aa[selectedRow] == ap.av.consensus)
+    if (selectedRow<aa.length && aa[selectedRow] == ap.av.consensus)
     {
       pop.addSeparator();
       final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(