From: amwaterhouse Date: Thu, 19 May 2005 17:54:30 +0000 (+0000) Subject: dont show redundant menuitems X-Git-Tag: Release_2_0~283 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a003b8e557f3b1a54e043264cb5c43b476bfc8f5;p=jalview.git dont show redundant menuitems --- diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index aed4a33..66b29a0 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -12,10 +12,7 @@ import MCview.*; public class PopupMenu extends JPopupMenu { JMenu groupMenu = new JMenu(); - JMenuItem analyze = new JMenuItem(); - JMenu defineMenu = new JMenu(); JMenuItem groupName = new JMenuItem(); - JMenuItem groupAnnotation = new JMenuItem(); protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem(); protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem(); protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem(); @@ -35,9 +32,6 @@ public class PopupMenu extends JPopupMenu AlignmentPanel ap; JMenu sequenceMenu = new JMenu(); JMenuItem sequenceName = new JMenuItem(); - JMenu residueMenu = new JMenu(); - JMenuItem annotateResidue = new JMenuItem(); - Sequence sequence; JMenuItem unGroupMenuItem = new JMenuItem(); JMenuItem pdbMenuItem = new JMenuItem(); @@ -109,25 +103,17 @@ public class PopupMenu extends JPopupMenu conservationMenuItem.setSelected(true); } + if( !ap.av.alignment.getGroups().contains(sg)) + unGroupMenuItem.setVisible(false); - if(seq!=null) - residueMenu.setVisible(false); - else - sequenceMenu.setVisible(false); + if(seq==null) + sequenceMenu.setVisible(false); } private void jbInit() throws Exception { groupMenu.setText("Group"); - analyze.setText("Analyze"); - analyze.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - analyze_actionPerformed(e); - } - }); - defineMenu.setText("Define"); + groupMenu.setText("Define"); groupName.setText("Name"); groupName.addActionListener(new java.awt.event.ActionListener() { @@ -136,15 +122,6 @@ public class PopupMenu extends JPopupMenu groupName_actionPerformed(e); } }); - groupAnnotation.setEnabled(false); - groupAnnotation.setText("Annotation"); - groupAnnotation.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - groupAnnotation_actionPerformed(e); - } - }); sequenceMenu.setText("Sequence"); sequenceName.setText("Edit name"); sequenceName.addActionListener(new java.awt.event.ActionListener() @@ -154,10 +131,6 @@ public class PopupMenu extends JPopupMenu sequenceName_actionPerformed(e); } }); - residueMenu.setText("Residue"); - annotateResidue.setEnabled(false); - annotateResidue.setActionCommand("annotate residue"); - annotateResidue.setText("annotate residue???"); PIDColour.setFocusPainted(false); unGroupMenuItem.setText("Remove Group"); unGroupMenuItem.addActionListener(new java.awt.event.ActionListener() @@ -192,41 +165,35 @@ public class PopupMenu extends JPopupMenu } }); add(groupMenu); - this.add(sequenceMenu); - this.add(residueMenu); - groupMenu.add(defineMenu); + add(sequenceMenu); + groupMenu.add(groupName); + groupMenu.addSeparator(); groupMenu.add(unGroupMenuItem); groupMenu.addSeparator(); - groupMenu.add(analyze); - defineMenu.add(groupName); - defineMenu.add(groupAnnotation); - defineMenu.addSeparator(); - defineMenu.add(outline); - defineMenu.addSeparator(); - defineMenu.add(noColourmenuItem); - defineMenu.add(clustalColour); - defineMenu.add(BLOSUM62Colour); - defineMenu.add(PIDColour); - - defineMenu.add(zappoColour); - defineMenu.add(taylorColour); - defineMenu.add(hydrophobicityColour); - defineMenu.add(helixColour); - defineMenu.add(strandColour); - defineMenu.add(turnColour); - defineMenu.add(buriedColour); - defineMenu.add(nucleotideMenuItem); - - defineMenu.add(userDefinedColour); - - defineMenu.addSeparator(); - defineMenu.add(abovePIDColour); - defineMenu.add(conservationMenuItem); + groupMenu.add(outline); + groupMenu.addSeparator(); + groupMenu.add(noColourmenuItem); + groupMenu.add(clustalColour); + groupMenu.add(BLOSUM62Colour); + groupMenu.add(PIDColour); + + groupMenu.add(zappoColour); + groupMenu.add(taylorColour); + groupMenu.add(hydrophobicityColour); + groupMenu.add(helixColour); + groupMenu.add(strandColour); + groupMenu.add(turnColour); + groupMenu.add(buriedColour); + groupMenu.add(nucleotideMenuItem); + + groupMenu.add(userDefinedColour); + + groupMenu.addSeparator(); + groupMenu.add(abovePIDColour); + groupMenu.add(conservationMenuItem); sequenceMenu.add(sequenceName); sequenceMenu.add(pdbMenuItem); - residueMenu.add(annotateResidue); - noColourmenuItem.setText("None"); noColourmenuItem.addActionListener(new java.awt.event.ActionListener() { @@ -609,6 +576,7 @@ public class PopupMenu extends JPopupMenu Color col = JColorChooser.showDialog(this, "Select Outline Colour", Color.BLUE); if(col!=null) sg.setOutlineColour(col); + ap.repaint(); } }