From: Jim Procter Date: Fri, 18 Apr 2014 09:50:15 +0000 (+0100) Subject: JAL-1477 first implementation of 'View all representative structures' option. X-Git-Tag: Jalview_2_9~123^2~39 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=caaee4e56aa9e2d6206a1cd19883cd7e58234062;p=jalview.git JAL-1477 first implementation of 'View all representative structures' option. --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index ce534e1..329eb8d 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -617,6 +617,7 @@ label.2d_rna_sequence_name = 2D RNA - {0} label.edit_name_and_description_current_group = Edit name and description of current group. label.view_structure_for = View structure for {0} label.view_all_structures = View all {0} structures. +label.view_all_representative_structures = View all {0} representative structures. label.associate_structure_with_sequence = Associate Structure with Sequence label.from_file = from file label.enter_pdb_id = Enter PDB Id diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 0e39f34..66cafc5 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -472,7 +472,7 @@ public class PopupMenu extends JPopupMenu buildGroupURLMenu(sg, groupLinks); } // Add a 'show all structures' for the current selection - Hashtable pdbe = new Hashtable(); + Hashtable pdbe = new Hashtable(),reppdb=new Hashtable(); SequenceI sqass = null; for (SequenceI sq : ap.av.getSequenceSelection()) { @@ -480,6 +480,7 @@ public class PopupMenu extends JPopupMenu .getPDBId(); if (pes != null) { + reppdb.put(pes.get(0).getId(),pes.get(0)); for (PDBEntry pe : pes) { pdbe.put(pe.getId(), pe); @@ -493,15 +494,16 @@ public class PopupMenu extends JPopupMenu if (pdbe.size() > 0) { final PDBEntry[] pe = pdbe.values().toArray( - new PDBEntry[pdbe.size()]); - final JMenuItem gpdbview; + 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()}))); + 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() @@ -513,6 +515,20 @@ public class PopupMenu extends JPopupMenu new AppJmol(ap, pe, ap.av.collateForPDB(pe)); } }); + if (reppdb.size()>1 && reppdb.size()