+ System.err.println("Building ws menu again "
+ + Thread.currentThread());
+ // TODO: add support for context dependent disabling of services based
+ // on
+ // alignment and current selection
+ // TODO: add additional serviceHandle parameter to specify abstract
+ // handler
+ // class independently of AbstractName
+ // TODO: add in rediscovery GUI function to restart discoverer
+ // TODO: group services by location as well as function and/or
+ // introduce
+ // object broker mechanism.
+ final Vector wsmenu = new Vector();
+ final IProgressIndicator af = me;
+ final JMenu msawsmenu = new JMenu("Alignment");
+ final JMenu secstrmenu = new JMenu(
+ "Secondary Structure Prediction");
+ final JMenu seqsrchmenu = new JMenu(
+ "Sequence Database Search");
+ final JMenu analymenu = new JMenu(
+ "Analysis");
+
+ if (Cache.getDefault("SHOW_JWS1_SERVICES", true)
+ && Discoverer.services != null
+ && (Discoverer.services.size() > 0))
+ {
+ // TODO: refactor to allow list of AbstractName/Handler bindings to
+ // be
+ // stored or retrieved from elsewhere
+ Vector msaws = (Vector) Discoverer.services.get("MsaWS");
+ Vector secstrpr = (Vector) Discoverer.services
+ .get("SecStrPred");
+ Vector seqsrch = (Vector) Discoverer.services.get("SeqSearch");
+ // TODO: move GUI generation code onto service implementation - so a
+ // client instance attaches itself to the GUI with method call like
+ // jalview.ws.MsaWSClient.bind(servicehandle, Desktop.instance,
+ // alignframe)
+ if (msaws != null)
+ {
+ // Add any Multiple Sequence Alignment Services
+ for (int i = 0, j = msaws.size(); i < j; i++)
+ {
+ final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws
+ .get(i);
+ jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
+ .getServiceClient(sh);
+ impl.attachWSMenuEntry(msawsmenu, me);
+
+ }
+ }
+ if (secstrpr != null)
+ {
+ // Add any secondary structure prediction services
+ for (int i = 0, j = secstrpr.size(); i < j; i++)
+ {
+ final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr
+ .get(i);
+ jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
+ .getServiceClient(sh);
+ impl.attachWSMenuEntry(secstrmenu, me);
+ }
+ }
+ if (seqsrch != null)
+ {
+ // Add any sequence search services
+ for (int i = 0, j = seqsrch.size(); i < j; i++)
+ {
+ final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) seqsrch
+ .elementAt(i);
+ jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer
+ .getServiceClient(sh);
+ impl.attachWSMenuEntry(seqsrchmenu, me);
+ }
+ }
+ }
+
+ // TODO: move into separate menu builder class.
+ if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
+ {
+ Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
+ if (jws2servs != null)
+ {
+ if (jws2servs.hasServices())
+ {
+ jws2servs.attachWSMenuEntry(msawsmenu, me);
+ }
+ }
+ }
+ // Add all submenus in the order they should appear on the web services menu
+ wsmenu.add(msawsmenu);
+ wsmenu.add(secstrmenu);
+ wsmenu.add(analymenu);
+ // No search services yet
+ // wsmenu.add(seqsrchmenu);
+
+ javax.swing.SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ webService.removeAll();
+ // first, add discovered services onto the webservices menu
+ if (wsmenu.size() > 0)
+ {
+ for (int i = 0, j = wsmenu.size(); i < j; i++)
+ {
+ webService.add((JMenu) wsmenu.get(i));
+ }
+ }
+ else
+ {
+ webService.add(me.webServiceNoServices);
+ }
+ build_urlServiceMenu(me.webService);
+ build_fetchdbmenu(webService);
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ });
+ } catch (Exception e)