Merge commit 'ab43013b7e357b84b4abade0dba949668dfb2a0e' into develop
[jalview.git] / src / jalview / gui / PopupMenu.java
index 41cb6b1..07b8d16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
  * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
@@ -29,6 +29,7 @@ import jalview.commands.EditCommand.Action;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.Sequence;
@@ -222,6 +223,8 @@ public class PopupMenu extends JPopupMenu
 
   JMenu groupLinksMenu;
 
+  JMenuItem hideInsertions = new JMenuItem();
+
   /**
    * Creates a new PopupMenu object.
    * 
@@ -1513,7 +1516,8 @@ public class PopupMenu extends JPopupMenu
         editSequence_actionPerformed(actionEvent);
       }
     });
-    makeReferenceSeq.setText("Mark as representative");
+    makeReferenceSeq.setText(MessageManager
+            .getString("label.mark_as_representative"));
     makeReferenceSeq.addActionListener(new ActionListener()
     {
       
@@ -1524,6 +1528,16 @@ public class PopupMenu extends JPopupMenu
         
       }
     });
+    hideInsertions.setText(MessageManager.getString("label.hide_insertions"));
+    hideInsertions.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        hideInsertions_actionPerformed(e);
+      }
+    });
     /*
      * annotationMenuItem.setText("By Annotation");
      * annotationMenuItem.addActionListener(new ActionListener() { public void
@@ -1533,7 +1547,11 @@ public class PopupMenu extends JPopupMenu
     groupMenu.add(sequenceSelDetails);
     add(groupMenu);
     add(sequenceMenu);
-    this.add(structureMenu);
+    add(structureMenu);
+    if (sequence!=null)
+    {
+      add(hideInsertions);
+    }
     // annotations configuration panel suppressed for now
     // groupMenu.add(chooseAnnotations);
 
@@ -1929,29 +1947,44 @@ public class PopupMenu extends JPopupMenu
     }
     refresh();
   }
-protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
-{
-  if (!ap.av.getAlignment().hasSeqrep())
-  {
-    // initialise the display flags so the user sees something happen
-    ap.av.setDisplayReferenceSeq(true);
-    ap.av.setColourByReferenceSeq(true);
-    ap.av.getAlignment().setSeqrep(sequence);
-  }
-  else
+
+  protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent)
   {
-    if (ap.av.getAlignment().getSeqrep() == sequence)
+    if (!ap.av.getAlignment().hasSeqrep())
     {
-      ap.av.getAlignment().setSeqrep(null);
+      // initialise the display flags so the user sees something happen
+      ap.av.setDisplayReferenceSeq(true);
+      ap.av.setColourByReferenceSeq(true);
+      ap.av.getAlignment().setSeqrep(sequence);
     }
     else
     {
-      ap.av.getAlignment().setSeqrep(sequence);
+      if (ap.av.getAlignment().getSeqrep() == sequence)
+      {
+        ap.av.getAlignment().setSeqrep(null);
+      }
+      else
+      {
+        ap.av.getAlignment().setSeqrep(sequence);
+      }
     }
+    refresh();
   }
-  refresh();
-}
 
+  protected void hideInsertions_actionPerformed(ActionEvent actionEvent)
+  {
+    if (sequence != null)
+    {
+      ColumnSelection cs = ap.av.getColumnSelection();
+      if (cs == null)
+      {
+        cs = new ColumnSelection();
+      }
+      cs.hideInsertionsFor(sequence);
+      ap.av.setColumnSelection(cs);
+    }
+    refresh();
+  }
   protected void sequenceSelectionDetails_actionPerformed()
   {
     createSequenceDetailsReport(ap.av.getSequenceSelection());