+ alignPanel.paintAlignment(false, false);
+ }
+
+ /**
+ * Build and show the popup-menu at the right-click mouse position
+ *
+ * @param e
+ */
+ void showPopupMenu(MouseEvent e, MousePos pos)
+ {
+ if (pos.isOverAnnotation())
+ {
+ showAnnotationMenu(e, pos);
+ return;
+ }
+
+ Sequence sq = (Sequence) av.getAlignment().getSequenceAt(pos.seqIndex);
+
+ /*
+ * build a new links menu based on the current links
+ * and any non-positional features
+ */
+ List<SequenceFeature> features = null;
+ if (sq != null)
+ {
+ List<String> nlinks = Preferences.sequenceUrlLinks.getLinksForMenu();
+ features = sq.getFeatures().getNonPositionalFeatures();
+ for (SequenceFeature sf : features)
+ {
+ if (sf.links != null)
+ {
+ nlinks.addAll(sf.links);
+ }
+ }
+ }
+
+ PopupMenu pop = new PopupMenu(alignPanel, sq, features,
+ Preferences.getGroupURLLinks());
+ pop.show(this, e.getX(), e.getY());
+ }
+
+ /**
+ * On right mouse click on a Consensus annotation label, shows a limited popup
+ * menu, with options to configure the consensus calculation and rendering.
+ *
+ * @param e
+ * @param pos
+ * @see AnnotationLabels#showPopupMenu(MouseEvent)
+ */
+ void showAnnotationMenu(MouseEvent e, MousePos pos)
+ {
+ if (pos.annotationIndex == -1)
+ {
+ return;
+ }
+ AlignmentAnnotation[] anns = this.av.getAlignment()
+ .getAlignmentAnnotation();
+ if (anns == null || pos.annotationIndex >= anns.length)
+ {
+ return;
+ }
+ AlignmentAnnotation ann = anns[pos.annotationIndex];
+ if (!ann.label.contains("Consensus"))
+ {
+ return;
+ }
+
+ JPopupMenu pop = new JPopupMenu(
+ MessageManager.getString("label.annotations"));
+ AnnotationLabels.addConsensusMenuOptions(this.alignPanel, ann, pop);
+ pop.show(this, e.getX(), e.getY());