-
- String dbs[] = null;
- try {
- dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases();
- } catch (Exception e)
- {
- jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e);
- continue;
- }
- JMenuItem method;
- // do default entry
- defmenu.add(method = new JMenuItem(sh.getName()));
- method.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- // use same input gatherer as for secondary structure prediction
- // we could actually parameterise the gatherer method here...
- AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
- new jalview.ws.SeqSearchWSClient(sh, title, msa, null,
- viewport.getAlignment().getDataset(),
- af);
- }
- }
- );
- // add entry for each database the service supports
- for (int db=0; dbs!=null && db<dbs.length; db++)
- {
- JMenu dbmenu = (JMenu) dbsrchs.get(dbs[db]);
- if (dbmenu==null)
- {
- dbsrchs.put(dbs[db], dbmenu = new JMenu(dbs[db]));
- }
- // add the client handler code for this service
- dbmenu.add(method = new JMenuItem(sh.getName()));
- final String searchdb = dbs[db];
- method.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
- new jalview.ws.SeqSearchWSClient(sh, title, msa, searchdb,
- viewport.getAlignment().getDataset(),
- af);
- }
- });
- }
- }
- // add the databases onto the seqsearch menu
- Enumeration e = dbsrchs.elements();
- while (e.hasMoreElements())
- {
- Object el = e.nextElement();
- if (el instanceof JMenu)
- {
- seqsrchmenu.add((JMenu) el);
- } else {
- seqsrchmenu.add((JMenuItem) el);
- }