Merge branch 'develop' into trialMerge
[jalview.git] / src / jalview / appletgui / APopupMenu.java
index 971630d..015734f 100644 (file)
@@ -24,17 +24,19 @@ import jalview.analysis.AAFrequency;
 import jalview.analysis.AlignmentAnnotationUtils;
 import jalview.analysis.AlignmentUtils;
 import jalview.analysis.Conservation;
+import jalview.bin.JalviewLite;
 import jalview.commands.ChangeCaseCommand;
 import jalview.commands.EditCommand;
 import jalview.commands.EditCommand.Action;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.io.AppletFormatAdapter;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormat;
 import jalview.io.SequenceAnnotationReport;
 import jalview.schemes.Blosum62ColourScheme;
 import jalview.schemes.BuriedColourScheme;
@@ -43,7 +45,6 @@ import jalview.schemes.HelixColourScheme;
 import jalview.schemes.HydrophobicColourScheme;
 import jalview.schemes.NucleotideColourScheme;
 import jalview.schemes.PIDColourScheme;
-import jalview.schemes.ResidueProperties;
 import jalview.schemes.StrandColourScheme;
 import jalview.schemes.TaylorColourScheme;
 import jalview.schemes.TurnColourScheme;
@@ -60,6 +61,7 @@ import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -70,8 +72,6 @@ import java.util.Vector;
 public class APopupMenu extends java.awt.PopupMenu implements
         ActionListener, ItemListener
 {
-  private static final String ALL_ANNOTATIONS = "All";
-
   Menu groupMenu = new Menu();
 
   MenuItem editGroupName = new MenuItem();
@@ -175,13 +175,13 @@ public class APopupMenu extends java.awt.PopupMenu implements
           MessageManager.getString("label.edit_sequence"));
 
   MenuItem sequenceDetails = new MenuItem(
-          MessageManager.getString("label.sequence_details") + "...");
+          MessageManager.getString("label.sequence_details"));
 
   MenuItem selSeqDetails = new MenuItem(
-          MessageManager.getString("label.sequence_details") + "...");
+          MessageManager.getString("label.sequence_details"));
 
   MenuItem makeReferenceSeq = new MenuItem();
-  
+
   SequenceI seq;
 
   MenuItem revealAll = new MenuItem();
@@ -216,10 +216,9 @@ public class APopupMenu extends java.awt.PopupMenu implements
       e.printStackTrace();
     }
 
-    for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++)
+    for (String ff : FileFormat.getWritableFormats(true))
     {
-      MenuItem item = new MenuItem(
-              jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
+      MenuItem item = new MenuItem(ff);
 
       item.addActionListener(this);
       outputmenu.add(item);
@@ -231,8 +230,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     if (sg != null && sg.getSize() > 0)
     {
       editGroupName.setLabel(MessageManager.formatMessage(
-              "label.name_param", new Object[]
-              { sg.getName() }));
+              "label.name_param", new Object[] { sg.getName() }));
       showText.setState(sg.getDisplayText());
       showColourText.setState(sg.getColourText());
       showBoxes.setState(sg.getDisplayBoxes());
@@ -257,123 +255,9 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
     if (links != null && links.size() > 0)
     {
-      Menu linkMenu = new Menu(MessageManager.getString("action.link"));
-      for (int i = 0; i < links.size(); i++)
-      {
-        String link = links.elementAt(i);
-        UrlLink urlLink = new UrlLink(link);
-        if (!urlLink.isValid())
-        {
-          System.err.println(urlLink.getInvalidMessage());
-          continue;
-        }
-        final String target = urlLink.getTarget(); // link.substring(0,
-        // link.indexOf("|"));
-        final String label = urlLink.getLabel();
-        if (seq != null && urlLink.isDynamic())
-        {
-
-          // collect matching db-refs
-          DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs(
-                  seq.getDBRef(), new String[]
-                  { target });
-          // collect id string too
-          String id = seq.getName();
-          String descr = seq.getDescription();
-          if (descr != null && descr.length() < 1)
-          {
-            descr = null;
-          }
-          if (dbr != null)
-          {
-            for (int r = 0; r < dbr.length; r++)
-            {
-              if (id != null && dbr[r].getAccessionId().equals(id))
-              {
-                // suppress duplicate link creation for the bare sequence ID
-                // string with this link
-                id = null;
-              }
-              // create Bare ID link for this RUL
-              String[] urls = urlLink.makeUrls(dbr[r].getAccessionId(),
-                      true);
-              if (urls != null)
-              {
-                for (int u = 0; u < urls.length; u += 2)
-                {
-                  addshowLink(linkMenu, label + "|" + urls[u], urls[u + 1]);
-                }
-              }
-            }
-          }
-          if (id != null)
-          {
-            // create Bare ID link for this RUL
-            String[] urls = urlLink.makeUrls(id, true);
-            if (urls != null)
-            {
-              for (int u = 0; u < urls.length; u += 2)
-              {
-                addshowLink(linkMenu, label, urls[u + 1]);
-              }
-            }
-            // addshowLink(linkMenu, target, url_pref + id + url_suff);
-          }
-          // Now construct URLs from description but only try to do it for regex
-          // URL links
-          if (descr != null && urlLink.getRegexReplace() != null)
-          {
-            // create link for this URL from description only if regex matches
-            String[] urls = urlLink.makeUrls(descr, true);
-            if (urls != null)
-            {
-              for (int u = 0; u < urls.length; u += 2)
-              {
-                addshowLink(linkMenu, label, urls[u + 1]);
-              }
-            }
-          }
-        }
-        else
-        {
-          addshowLink(linkMenu, target, urlLink.getUrl_prefix()); // link.substring(link.lastIndexOf("|")+1));
-        }
-        /*
-         * final String url;
-         * 
-         * if (link.indexOf("$SEQUENCE_ID$") > -1) { // Substitute SEQUENCE_ID
-         * string and any matching database reference accessions String url_pref
-         * = link.substring(link.indexOf("|") + 1,
-         * link.indexOf("$SEQUENCE_ID$"));
-         * 
-         * String url_suff = link.substring(link.indexOf("$SEQUENCE_ID$") + 13);
-         * // collect matching db-refs DBRefEntry[] dbr =
-         * jalview.util.DBRefUtils.selectRefs(seq.getDBRef(), new
-         * String[]{target}); // collect id string too String id =
-         * seq.getName(); if (id.indexOf("|") > -1) { id =
-         * id.substring(id.lastIndexOf("|") + 1); } if (dbr!=null) { for (int
-         * r=0;r<dbr.length; r++) { if (dbr[r].getAccessionId().equals(id)) { //
-         * suppress duplicate link creation for the bare sequence ID string with
-         * this link id = null; } addshowLink(linkMenu,
-         * dbr[r].getSource()+"|"+dbr[r].getAccessionId(), target,
-         * url_pref+dbr[r].getAccessionId()+url_suff); } } if (id!=null) { //
-         * create Bare ID link for this RUL addshowLink(linkMenu, target,
-         * url_pref + id + url_suff); } } else { addshowLink(linkMenu, target,
-         * link.substring(link.lastIndexOf("|")+1)); }
-         */
-      }
-      if (linkMenu.getItemCount() > 0)
-      {
-        if (seq != null)
-        {
-          seqMenu.add(linkMenu);
-        }
-        else
-        {
-          add(linkMenu);
-        }
-      }
+      addFeatureLinks(seq, links);
     }
+
     // TODO: add group link menu entry here
     if (seq != null)
     {
@@ -390,8 +274,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
                 .getString("action.set_as_reference")); // );
       }
       repGroup.setLabel(MessageManager.formatMessage(
-              "label.represent_group_with", new Object[]
-              { seq.getName() }));
+              "label.represent_group_with", new Object[] { seq.getName() }));
     }
     else
     {
@@ -420,6 +303,71 @@ public class APopupMenu extends java.awt.PopupMenu implements
   }
 
   /**
+   * Adds a 'Link' menu item with a sub-menu item for each hyperlink provided.
+   * 
+   * @param seq
+   * @param links
+   */
+  void addFeatureLinks(final SequenceI seq, List<String> links)
+  {
+    Menu linkMenu = new Menu(MessageManager.getString("action.link"));
+    Map<String, List<String>> linkset = new LinkedHashMap<String, List<String>>();
+
+    for (String link : links)
+    {
+      UrlLink urlLink = null;
+      try
+      {
+        urlLink = new UrlLink(link);
+      } catch (Exception foo)
+      {
+        System.err.println("Exception for URLLink '" + link + "': "
+                + foo.getMessage());
+        continue;
+      }
+
+      if (!urlLink.isValid())
+      {
+        System.err.println(urlLink.getInvalidMessage());
+        continue;
+      }
+
+      urlLink.createLinksFromSeq(seq, linkset);
+    }
+
+    addshowLinks(linkMenu, linkset.values());
+
+    // disable link menu if there are no valid entries
+    if (linkMenu.getItemCount() > 0)
+    {
+      linkMenu.setEnabled(true);
+    }
+    else
+    {
+      linkMenu.setEnabled(false);
+    }
+
+    if (seq != null)
+    {
+      seqMenu.add(linkMenu);
+    }
+    else
+    {
+      add(linkMenu);
+    }
+
+  }
+
+  private void addshowLinks(Menu linkMenu, Collection<List<String>> linkset)
+  {
+    for (List<String> linkstrset : linkset)
+    {
+      // split linkstr into label and url
+      addshowLink(linkMenu, linkstrset.get(1), linkstrset.get(3));
+    }
+  }
+
+  /**
    * Build menus for annotation types that may be shown or hidden, and for
    * 'reference annotations' that may be added to the alignment.
    */
@@ -540,6 +488,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     MenuItem item = new MenuItem(label);
     item.addActionListener(new java.awt.event.ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         ap.alignFrame.showURL(url, target);
@@ -548,6 +497,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     linkMenu.add(item);
   }
 
+  @Override
   public void itemStateChanged(ItemEvent evt)
   {
     if (evt.getSource() == abovePIDColour)
@@ -572,6 +522,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     }
   }
 
+  @Override
   public void actionPerformed(ActionEvent evt)
   {
     Object source = evt.getSource();
@@ -720,7 +671,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
         if (dialog.accept)
         {
-          EditCommand editCommand = new EditCommand(MessageManager.getString("label.edit_sequences"),
+          EditCommand editCommand = new EditCommand(
+                  MessageManager.getString("label.edit_sequences"),
                   Action.REPLACE, dialog.getName().replace(' ',
                           ap.av.getGapCharacter()),
                   sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
@@ -807,7 +759,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
               features, true, ap))
       {
         ap.alignFrame.sequenceFeatures.setState(true);
-        ap.av.setShowSequenceFeatures(true);;
+        ap.av.setShowSequenceFeatures(true);
+        ;
         ap.highlightSearchResults(null);
       }
     }
@@ -824,15 +777,16 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
     Frame frame = new Frame();
     frame.add(cap);
-    jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
-            "label.selection_output_command", new Object[]
-            { e.getActionCommand() }), 600, 500);
+    JalviewLite.addFrame(frame, MessageManager.formatMessage(
+            "label.selection_output_command",
+            new Object[] { e.getActionCommand() }), 600, 500);
     // JBPNote: getSelectionAsNewSequence behaviour has changed - this method
     // now returns a full copy of sequence data
     // TODO consider using getSequenceSelection instead here
 
-    cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(
-            e.getActionCommand(), ap.av.getShowJVSuffix(), ap.av, true));
+    FileFormat fileFormat = FileFormat.valueOf(e.getActionCommand());
+    cap.setText(new AppletFormatAdapter().formatSequences(fileFormat,
+            ap.av.getShowJVSuffix(), ap, true));
 
   }
 
@@ -843,8 +797,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
   protected void showSequenceDetails()
   {
-    createSequenceDetailsReport(new SequenceI[]
-    { seq });
+    createSequenceDetailsReport(new SequenceI[] { seq });
   }
 
   public void createSequenceDetailsReport(SequenceI[] sequences)
@@ -852,21 +805,19 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
     CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);
 
-    StringBuffer contents = new StringBuffer();
+    StringBuilder contents = new StringBuilder(128);
     for (SequenceI seq : sequences)
     {
       contents.append(MessageManager.formatMessage(
-              "label.annotation_for_displayid", new Object[]
-              { seq.getDisplayId(true) }));
-      new SequenceAnnotationReport(null)
-              .createSequenceAnnotationReport(
-                      contents,
-                      seq,
-                      true,
-                      true,
-                      false,
-                      (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.getMinMax()
-                              : null);
+              "label.annotation_for_displayid",
+              new Object[] { seq.getDisplayId(true) }));
+      new SequenceAnnotationReport(null).createSequenceAnnotationReport(
+              contents,
+              seq,
+              true,
+              true,
+              (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr
+                      .getMinMax() : null);
       contents.append("</p>");
     }
     Frame frame = new Frame();
@@ -875,8 +826,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
             + (sequences.length == 1 ? sequences[0].getDisplayId(true)
                     : "Selection"), 600, 500);
     cap.setText(MessageManager.formatMessage("label.html_content",
-            new Object[]
-            { contents.toString() }));
+            new Object[] { contents.toString() }));
   }
 
   void editName()
@@ -896,19 +846,20 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
   void addPDB()
   {
-    if (seq.getPDBId() != null)
+    Vector<PDBEntry> pdbs = seq.getAllPDBEntries();
+    if (pdbs != null&& !pdbs.isEmpty())
     {
-      PDBEntry entry = seq.getPDBId().firstElement();
+      PDBEntry entry = pdbs.firstElement();
 
       if (ap.av.applet.jmolAvailable)
       {
-        new jalview.appletgui.AppletJmol(entry, new SequenceI[]
-        { seq }, null, ap, AppletFormatAdapter.URL);
+        new jalview.appletgui.AppletJmol(entry, new SequenceI[] { seq },
+                null, ap, DataSourceType.URL);
       }
       else
       {
-        new MCview.AppletPDBViewer(entry, new SequenceI[]
-        { seq }, null, ap, AppletFormatAdapter.URL);
+        new MCview.AppletPDBViewer(entry, new SequenceI[] { seq }, null,
+                ap, DataSourceType.URL);
       }
 
     }
@@ -920,8 +871,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
       Frame frame = new Frame();
       frame.add(cap);
       jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage(
-              "label.paste_pdb_file_for_sequence", new Object[]
-              { seq.getName() }), 400, 300);
+              "label.paste_pdb_file_for_sequence",
+              new Object[] { seq.getName() }), 400, 300);
     }
   }
 
@@ -964,11 +915,10 @@ public class APopupMenu extends java.awt.PopupMenu implements
     pdb.setLabel(MessageManager.getString("label.view_pdb_structure"));
     hideSeqs.setLabel(MessageManager.getString("action.hide_sequences"));
     repGroup.setLabel(MessageManager.formatMessage(
-            "label.represent_group_with", new Object[]
-            { "" }));
+            "label.represent_group_with", new Object[] { "" }));
     revealAll.setLabel(MessageManager.getString("action.reveal_all"));
     revealSeq.setLabel(MessageManager.getString("action.reveal_sequences"));
-    menu1.setLabel(MessageManager.getString("label.group") + ":");
+    menu1.setLabel(MessageManager.getString("label.group:"));
     add(groupMenu);
     this.add(seqMenu);
     this.add(hideSeqs);
@@ -1005,31 +955,39 @@ public class APopupMenu extends java.awt.PopupMenu implements
     noColourmenuItem.setLabel(MessageManager.getString("label.none"));
     noColourmenuItem.addActionListener(this);
 
-    clustalColour.setLabel(MessageManager.getString("label.clustalx_colours"));
+    clustalColour.setLabel(MessageManager
+            .getString("label.clustalx_colours"));
     clustalColour.addActionListener(this);
     zappoColour.setLabel(MessageManager.getString("label.zappo"));
     zappoColour.addActionListener(this);
     taylorColour.setLabel(MessageManager.getString("label.taylor"));
     taylorColour.addActionListener(this);
-    hydrophobicityColour.setLabel(MessageManager.getString("label.hydrophobicity"));
+    hydrophobicityColour.setLabel(MessageManager
+            .getString("label.hydrophobicity"));
     hydrophobicityColour.addActionListener(this);
-    helixColour.setLabel(MessageManager.getString("label.helix_propensity"));
+    helixColour
+            .setLabel(MessageManager.getString("label.helix_propensity"));
     helixColour.addActionListener(this);
-    strandColour.setLabel(MessageManager.getString("label.strand_propensity"));
+    strandColour.setLabel(MessageManager
+            .getString("label.strand_propensity"));
     strandColour.addActionListener(this);
     turnColour.setLabel(MessageManager.getString("label.turn_propensity"));
     turnColour.addActionListener(this);
     buriedColour.setLabel(MessageManager.getString("label.buried_index"));
     buriedColour.addActionListener(this);
-    abovePIDColour.setLabel(MessageManager.getString("label.above_identity_percentage"));
+    abovePIDColour.setLabel(MessageManager
+            .getString("label.above_identity_percentage"));
 
-    userDefinedColour.setLabel(MessageManager.getString("action.user_defined"));
+    userDefinedColour.setLabel(MessageManager
+            .getString("action.user_defined"));
     userDefinedColour.addActionListener(this);
-    PIDColour.setLabel(MessageManager.getString("action.percentage_identity"));
+    PIDColour.setLabel(MessageManager
+            .getString("label.percentage_identity"));
     PIDColour.addActionListener(this);
     BLOSUM62Colour.setLabel("BLOSUM62");
     BLOSUM62Colour.addActionListener(this);
-    conservationMenuItem.setLabel(MessageManager.getString("label.conservation"));
+    conservationMenuItem.setLabel(MessageManager
+            .getString("label.conservation"));
 
     editMenu.add(copy);
     copy.addActionListener(this);
@@ -1203,11 +1161,10 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
     if (conservationMenuItem.getState())
     {
-
-      sg.cs.setConservation(Conservation.calculateConservation("Group",
-              ResidueProperties.propHash, 3, sg.getSequences(ap.av
-                      .getHiddenRepSequences()), 0, ap.av.getAlignment()
-                      .getWidth(), false, ap.av.getConsPercGaps(), false));
+      sg.cs.setConservation(Conservation.calculateConservation("Group", sg
+              .getSequences(ap.av.getHiddenRepSequences()), 0, ap.av
+              .getAlignment().getWidth(), false, ap.av.getConsPercGaps(),
+              false));
       SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());
       SliderPanel.showConservationSlider();
     }
@@ -1258,6 +1215,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
     getGroup().setDisplayText(showText.getState());
     refresh();
   }
+
   public void makeReferenceSeq_actionPerformed()
   {
     if (!ap.av.getAlignment().hasSeqrep())
@@ -1295,36 +1253,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
 
   void hideSequences(boolean representGroup)
   {
-    SequenceGroup sg = ap.av.getSelectionGroup();
-    if (sg == null || sg.getSize() < 1)
-    {
-      ap.av.hideSequence(new SequenceI[]
-      { seq });
-      return;
-    }
-
-    ap.av.setSelectionGroup(null);
-
-    if (representGroup)
-    {
-      ap.av.hideRepSequences(seq, sg);
-
-      return;
-    }
-
-    int gsize = sg.getSize();
-    SequenceI[] hseqs;
-
-    hseqs = new SequenceI[gsize];
-
-    int index = 0;
-    for (int i = 0; i < gsize; i++)
-    {
-      hseqs[index++] = sg.getSequenceAt(i);
-    }
-
-    ap.av.hideSequence(hseqs);
-    ap.av.sendSelection();
+    ap.av.hideSequences(seq, representGroup);
   }
 
   /**
@@ -1347,17 +1276,18 @@ public class APopupMenu extends java.awt.PopupMenu implements
   {
     showMenu.removeAll();
     hideMenu.removeAll();
-  
-    final List<String> all = Arrays.asList(ALL_ANNOTATIONS);
+
+    final List<String> all = Arrays.asList(new String[] { MessageManager
+            .getString("label.all") });
     addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true);
     addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true,
             false);
     showMenu.addSeparator();
     hideMenu.addSeparator();
-  
+
     final AlignmentAnnotation[] annotations = ap.getAlignment()
             .getAlignmentAnnotation();
-  
+
     /*
      * Find shown/hidden annotations types, distinguished by source (calcId),
      * and grouped by graphGroup. Using LinkedHashMap means we will retrieve in
@@ -1366,28 +1296,26 @@ public class APopupMenu extends java.awt.PopupMenu implements
      */
     Map<String, List<List<String>>> shownTypes = new LinkedHashMap<String, List<List<String>>>();
     Map<String, List<List<String>>> hiddenTypes = new LinkedHashMap<String, List<List<String>>>();
-    AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes,
-            hiddenTypes,
-            AlignmentAnnotationUtils.asList(annotations),
-            forSequences);
-  
+    AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
+            AlignmentAnnotationUtils.asList(annotations), forSequences);
+
     for (String calcId : hiddenTypes.keySet())
     {
       for (List<String> type : hiddenTypes.get(calcId))
       {
-        addAnnotationTypeToShowHide(showMenu, forSequences,
-                calcId, type, false, true);
+        addAnnotationTypeToShowHide(showMenu, forSequences, calcId, type,
+                false, true);
       }
     }
     // grey out 'show annotations' if none are hidden
     showMenu.setEnabled(!hiddenTypes.isEmpty());
-  
+
     for (String calcId : shownTypes.keySet())
     {
       for (List<String> type : shownTypes.get(calcId))
       {
-        addAnnotationTypeToShowHide(hideMenu, forSequences,
-                calcId, type, false, false);
+        addAnnotationTypeToShowHide(hideMenu, forSequences, calcId, type,
+                false, false);
       }
     }
     // grey out 'hide annotations' if none are shown
@@ -1424,8 +1352,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        AlignmentUtils.showOrHideSequenceAnnotations(ap.getAlignment(), types,
-                forSequences, allTypes, actionIsShow);
+        AlignmentUtils.showOrHideSequenceAnnotations(ap.getAlignment(),
+                types, forSequences, allTypes, actionIsShow);
         refresh();
       }
     });