- int seq2 = alignPanel.getSeqPanel().findSeq(e);
- Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq2);
- // build a new links menu based on the current links + any non-positional
- // features
- Vector<String> nlinks = new Vector<String>(
- Preferences.sequenceURLLinks);
- SequenceFeature sfs[] = sq == null ? null : sq.getSequenceFeatures();
- if (sfs != null)
- {
- for (SequenceFeature sf : sfs)
- {
- if (sf.begin == sf.end && sf.begin == 0)
- {
- if (sf.links != null && sf.links.size() > 0)
- {
- for (int l = 0, lSize = sf.links.size(); l < lSize; l++)
- {
- nlinks.addElement(sf.links.elementAt(l));
- }
- }
- }
- }
+ if (pos.isOverAnnotation())
+ {
+ showAnnotationMenu(e, pos);
+ return;
+ }
+
+ Sequence sq = (Sequence) av.getAlignment().getSequenceAt(pos.seqIndex);
+ if (sq != null)
+ {
+ PopupMenu pop = new PopupMenu(alignPanel, sq,
+ 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;