JAL-1749 reinstated the ability to view RNA structures
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 28 May 2015 10:03:04 +0000 (11:03 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 28 May 2015 10:03:04 +0000 (11:03 +0100)
resources/lang/Messages.properties
src/jalview/gui/PopupMenu.java

index e25fb93..1af3839 100644 (file)
@@ -1,4 +1,4 @@
-action.refresh_services = Refresh Services
+label.view_structureaction.refresh_services = Refresh Services
 action.reset_services = Reset Services
 action.merge_results = Merge Results
 action.load_scheme = Load scheme
@@ -675,6 +675,8 @@ label.discover_pdb_ids = Discover PDB ids
 label.text_colour = Text Colour
 label.structure = Structure
 label.view_structure = View Structure
+label.view_protein_structure = View Protein Structure
+label.view_rna_structure = View Nucleotide Structure
 label.clustalx_colours = Clustalx colours
 label.above_identity_percentage = Above % Identity
 label.create_sequence_details_report_annotation_for = Annotation for {0}
index 013f4d2..0d28a70 100644 (file)
@@ -204,9 +204,9 @@ public class PopupMenu extends JPopupMenu
 
   JMenu jMenu1 = new JMenu();
 
-  JMenuItem structureMenu = new JMenuItem();
+  JMenuItem proteinStructureMenu = new JMenuItem();
 
-  JMenu viewStructureMenu = new JMenu();
+  JMenu rnaStructureMenu = new JMenu();
 
   JMenuItem editSequence = new JMenuItem();
 
@@ -322,51 +322,11 @@ public class PopupMenu extends JPopupMenu
         makeReferenceSeq.setText("Mark as representative");
       }
 
-      if (seq.getDatasetSequence().getPDBId() != null
-              && seq.getDatasetSequence().getPDBId().size() > 0)
+      if (ap.av.getAlignment().isNucleotide() == false)
       {
-        java.util.Enumeration e = seq.getDatasetSequence().getPDBId()
-                .elements();
-
-        while (e.hasMoreElements())
-        {
-          final PDBEntry pdb = (PDBEntry) e.nextElement();
-
-          menuItem = new JMenuItem();
-          menuItem.setText(pdb.getId());
-          menuItem.addActionListener(new ActionListener()
-          {
-            @Override
-            public void actionPerformed(ActionEvent e)
-            {
-              // TODO re JAL-860: optionally open dialog or provide a menu entry
-              // allowing user to open just one structure per sequence
-              // new AppJmol(pdb, ap.av.collateForPDB(new PDBEntry[]
-              // { pdb })[0], null, ap);
-              new StructureViewer(ap.getStructureSelectionManager())
-                      .viewStructures(pdb,
-                              ap.av.collateForPDB(new PDBEntry[]
-                              { pdb })[0], null, ap);
-            }
-          });
-          viewStructureMenu.add(menuItem);
-
-          /*
-           * menuItem = new JMenuItem(); menuItem.setText(pdb.getId());
-           * menuItem.addActionListener(new java.awt.event.ActionListener() {
-           * public void actionPerformed(ActionEvent e) {
-           * colourByStructure(pdb.getId()); } });
-           * colStructureMenu.add(menuItem);
-           */
-        }
-      }
-      else
-      {
-        if (ap.av.getAlignment().isNucleotide() == false)
-        {
-          structureMenu.remove(viewStructureMenu);
-        }
+        remove(rnaStructureMenu);
       }
+
       if (ap.av.getAlignment().isNucleotide() == true)
       {
         AlignmentAnnotation[] aa = ap.av.getAlignment()
@@ -391,7 +351,7 @@ public class PopupMenu extends JPopupMenu
                 System.out.println("end");
               }
             });
-            viewStructureMenu.add(menuItem);
+            rnaStructureMenu.add(menuItem);
           }
         }
 
@@ -422,7 +382,7 @@ public class PopupMenu extends JPopupMenu
                           ap);
                 }
               });
-              viewStructureMenu.add(menuItem);
+              rnaStructureMenu.add(menuItem);
             }
           }
         }
@@ -638,7 +598,8 @@ public class PopupMenu extends JPopupMenu
     if (seq == null)
     {
       sequenceMenu.setVisible(false);
-      structureMenu.setVisible(false);
+      proteinStructureMenu.setVisible(false);
+      rnaStructureMenu.setVisible(false);
     }
 
     if (links != null && links.size() > 0)
@@ -1379,8 +1340,9 @@ public class PopupMenu extends JPopupMenu
       }
     });
     jMenu1.setText(MessageManager.getString("label.group"));
-    structureMenu.setText(MessageManager.getString("label.view_structure"));
-    structureMenu.addActionListener(new ActionListener()
+    proteinStructureMenu.setText(MessageManager
+            .getString("label.view_protein_structure"));
+    proteinStructureMenu.addActionListener(new ActionListener()
     {
       @Override
       public void actionPerformed(ActionEvent actionEvent)
@@ -1395,8 +1357,9 @@ public class PopupMenu extends JPopupMenu
       }
     });
 
-    viewStructureMenu.setText(MessageManager
-            .getString("label.view_structure"));
+    rnaStructureMenu.setText(MessageManager
+            .getString("label.view_rna_structure"));
+
     // colStructureMenu.setText("Colour By Structure");
     editSequence.setText(MessageManager.getString("label.edit_sequence")
             + "...");
@@ -1439,7 +1402,8 @@ public class PopupMenu extends JPopupMenu
     groupMenu.add(sequenceSelDetails);
     add(groupMenu);
     add(sequenceMenu);
-    add(structureMenu);
+    add(rnaStructureMenu);
+    add(proteinStructureMenu);
     if (sequence!=null)
     {
       add(hideInsertions);