+
+ /**
+ * look at ourselves and work out if we are a service that can take a profile
+ * and align to it
+ *
+ * @return true if we can send gapped sequences to the alignment service
+ */
+ private boolean canSubmitGaps()
+ {
+ // TODO: query service or extract service handle props to check if we can
+ // realign
+ return (WebServiceName.indexOf("lustal") > -1); // cheat!
+ }
+
+ public void attachWSMenuEntry(JMenu msawsmenu,
+ final ServiceHandle serviceHandle, final AlignFrame alignFrame)
+ {
+ setWebService(serviceHandle, true); // headless
+ JMenuItem method = new JMenuItem(WebServiceName);
+ method.setToolTipText(WsURL);
+ method.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ AlignmentView msa = alignFrame.gatherSequencesForAlignment();
+ new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(),
+ msa, false, true, alignFrame.getViewport().getAlignment()
+ .getDataset(), alignFrame);
+
+ }
+
+ });
+ msawsmenu.add(method);
+ if (canSubmitGaps())
+ {
+ // We know that ClustalWS can accept partial alignments for refinement.
+ final JMenuItem methodR = new JMenuItem(serviceHandle.getName()
+ + " Realign");
+ methodR.setToolTipText(WsURL);
+ methodR.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ AlignmentView msa = alignFrame.gatherSequencesForAlignment();
+ new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(),
+ msa, true, true, alignFrame.getViewport().getAlignment()
+ .getDataset(), alignFrame);
+
+ }
+
+ });
+ msawsmenu.add(methodR);
+
+ }
+
+ }