+ /**
+ * Send a command to the structure viewer to create residue attributes for
+ * Jalview features
+ */
+ abstract protected void sendFeaturesToViewer();
+
+ /**
+ * Query the structure viewer for its residue attribute names and add them as
+ * sub-items of the attributes menu. Names of the form "jv_*" are ignored as
+ * these originated from Jalview so no need to copy them back.
+ *
+ * @param attributesMenu
+ */
+ protected void buildAttributesMenu(JMenu attributesMenu)
+ {
+ List<String> atts = getResidueAttributeNames();
+ if (atts == null)
+ {
+ return;
+ }
+ attributesMenu.removeAll();
+ Collections.sort(atts);
+ for (final String att : atts)
+ {
+ /*
+ * ignore 'jv_*' attributes, as these are Jalview features that have
+ * been transferred to residue attributes in Chimera!
+ */
+ if (!att.startsWith(StructureViewerBase.NAMESPACE_PREFIX))
+ {
+ JMenuItem menuItem = new JMenuItem(att);
+ menuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ getResidueAttributes(att);
+ }
+ });
+ attributesMenu.add(menuItem);
+ }
+ }
+ }
+
+ /**
+ * Queries the structure viewer for residues with the given attribute, and
+ * creates sequence features in Jalview for the corresponding mapped positions
+ *
+ * @param attName
+ */
+ protected abstract void getResidueAttributes(String attName);
+
+ /**
+ * Returns a list of residue attributes in the structure viewer, excluding any
+ * with prefix "jv_"
+ *
+ * @return
+ */
+ protected abstract List<String> getResidueAttributeNames();
+