X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPopupMenu.java;h=0a40af7ea97aed09a7660659953d1dac7d7579fe;hb=d9cedb863c0d5b665b8cdde3f8791d8a96030c6b;hp=41cb6b11d115cdb8f5bff0842bc6f73e94a1dac0;hpb=b948e764c92b0954100f216927114b2c9720b76c;p=jalview.git diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 41cb6b1..0a40af7 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -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; @@ -211,7 +212,7 @@ public class PopupMenu extends JPopupMenu JMenu jMenu1 = new JMenu(); - JMenu structureMenu = new JMenu(); + JMenuItem structureMenu = new JMenuItem(); JMenu viewStructureMenu = new JMenu(); @@ -222,6 +223,8 @@ public class PopupMenu extends JPopupMenu JMenu groupLinksMenu; + JMenuItem hideInsertions = new JMenuItem(); + /** * Creates a new PopupMenu object. * @@ -636,50 +639,50 @@ public class PopupMenu extends JPopupMenu new PDBEntry[pdbe.size()]), pr = reppdb.values().toArray( new PDBEntry[reppdb.size()]); final JMenuItem gpdbview, rpdbview; - if (pdbe.size() == 1) - { - structureMenu.add(gpdbview = new JMenuItem(MessageManager - .formatMessage("label.view_structure_for", new String[] - { sqass.getDisplayId(false) }))); - } - else - { - structureMenu.add(gpdbview = new JMenuItem(MessageManager - .formatMessage("label.view_all_structures", new String[] - { new Integer(pdbe.size()).toString() }))); - } - gpdbview.setToolTipText(MessageManager - .getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment")); - gpdbview.addActionListener(new ActionListener() - { - - @Override - public void actionPerformed(ActionEvent e) - { - new StructureViewer(ap.getStructureSelectionManager()) - .viewStructures(ap, pe, ap.av.collateForPDB(pe)); - } - }); - if (reppdb.size() > 1 && reppdb.size() < pdbe.size()) - { - structureMenu.add(rpdbview = new JMenuItem(MessageManager - .formatMessage( - "label.view_all_representative_structures", - new String[] - { new Integer(reppdb.size()).toString() }))); - rpdbview.setToolTipText(MessageManager - .getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment")); - rpdbview.addActionListener(new ActionListener() - { - - @Override - public void actionPerformed(ActionEvent e) - { - new StructureViewer(ap.getStructureSelectionManager()) - .viewStructures(ap, pr, ap.av.collateForPDB(pr)); - } - }); - } + // if (pdbe.size() == 1) + // { + // structureMenu.add(gpdbview = new JMenuItem(MessageManager + // .formatMessage("label.view_structure_for", new String[] + // { sqass.getDisplayId(false) }))); + // } + // else + // { + // structureMenu.add(gpdbview = new JMenuItem(MessageManager + // .formatMessage("label.view_all_structures", new String[] + // { new Integer(pdbe.size()).toString() }))); + // } + // gpdbview.setToolTipText(MessageManager + // .getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment")); + // gpdbview.addActionListener(new ActionListener() + // { + // + // @Override + // public void actionPerformed(ActionEvent e) + // { + // new StructureViewer(ap.getStructureSelectionManager()) + // .viewStructures(ap, pe, ap.av.collateForPDB(pe)); + // } + // }); + // if (reppdb.size() > 1 && reppdb.size() < pdbe.size()) + // { + // structureMenu.add(rpdbview = new JMenuItem(MessageManager + // .formatMessage( + // "label.view_all_representative_structures", + // new String[] + // { new Integer(reppdb.size()).toString() }))); + // rpdbview.setToolTipText(MessageManager + // .getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment")); + // rpdbview.addActionListener(new ActionListener() + // { + // + // @Override + // public void actionPerformed(ActionEvent e) + // { + // new StructureViewer(ap.getStructureSelectionManager()) + // .viewStructures(ap, pr, ap.av.collateForPDB(pr)); + // } + // }); + // } } } else @@ -1499,7 +1502,23 @@ public class PopupMenu extends JPopupMenu } }); jMenu1.setText(MessageManager.getString("label.group")); - structureMenu.setText(MessageManager.getString("label.structure")); + // structureMenu.setText(MessageManager.getString("label.structure")); + structureMenu.setText(MessageManager.getString("label.view_structure")); + structureMenu.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + SequenceI[] selectedSeqs = new SequenceI[] + { sequence }; + if (ap.av.getSelectionGroup() != null) + { + selectedSeqs = ap.av.getSequenceSelection(); + } + new StructureChooser(selectedSeqs, sequence, ap); + } + }); + viewStructureMenu.setText(MessageManager .getString("label.view_structure")); // colStructureMenu.setText("Colour By Structure"); @@ -1513,7 +1532,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 +1544,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 +1563,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); @@ -1622,8 +1656,8 @@ public class PopupMenu extends JPopupMenu jMenu1.add(showColourText); jMenu1.add(outline); jMenu1.add(displayNonconserved); - structureMenu.add(pdbMenu); - structureMenu.add(viewStructureMenu); + // structureMenu.add(pdbMenu); + // structureMenu.add(viewStructureMenu); // structureMenu.add(colStructureMenu); noColourmenuItem.setText(MessageManager.getString("label.none")); noColourmenuItem.addActionListener(new java.awt.event.ActionListener() @@ -1929,29 +1963,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()); @@ -1990,10 +2039,10 @@ protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent) } cap.setText("" + contents.toString() + ""); - Desktop.instance.addInternalFrame(cap, MessageManager.formatMessage( - "label.sequece_details_for", - (sequences.length == 1 ? new String[] - { sequences[0].getDisplayId(true) } : new String[] + Desktop.addInternalFrame(cap, MessageManager.formatMessage( + "label.sequence_details_for", + (sequences.length == 1 ? new Object[] + { sequences[0].getDisplayId(true) } : new Object[] { MessageManager.getString("label.selection") })), 500, 400); }