From: Mateusz Warowny Date: Fri, 17 Jul 2020 10:59:21 +0000 (+0100) Subject: JAL-3690 restore jws1 JPred X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=01bf99892a24279c17fc18c19de0d1661f1faff2;p=jalview.git JAL-3690 restore jws1 JPred --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index d7a95a4..71f8c7d 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -160,6 +160,7 @@ import jalview.ws.DBRefFetcher.FetchFinishedListenerI; import jalview.ws.ServiceChangeListener; import jalview.ws.WSDiscovererI; import jalview.ws.api.ServiceWithParameters; +import jalview.ws.jws1.Discoverer; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.PreferredServiceRegistry; import jalview.ws.params.ArgumentI; @@ -4421,12 +4422,31 @@ public class AlignFrame extends GAlignFrame { WSDiscovererI jws2servs = Jws2Discoverer.getDiscoverer(); JMenu submenu = new JMenu("JABAWS"); + buildLegacyWebServicesMenu(submenu); buildWebServicesMenu(jws2servs, submenu); webService.add(submenu); } }); } + private void buildLegacyWebServicesMenu(JMenu menu) + { + JMenu secstrmenu = new JMenu("Secondary Structure Prediction"); + if (Discoverer.services != null && Discoverer.services.size() > 0) + { + var secstrpred = Discoverer.services.get("SecStrPred"); + if (secstrpred != null) + { + for (ext.vamsas.ServiceHandle sh : secstrpred) + { + var menuProvider = Discoverer.getServiceClient(sh); + menuProvider.attachWSMenuEntry(secstrmenu, this); + } + } + } + menu.add(secstrmenu); + } + /** * Constructs the web services menu for the given discoverer under the * specified menu. This method must be called on the EDT @@ -4457,206 +4477,6 @@ public class AlignFrame extends GAlignFrame } } -// private boolean buildingMenu = false; - - /** - * Generates menu items and listener event actions for web service clients - * - */ -// public void BuildWebServiceMenu() -// { -// while (buildingMenu) -// { -// try -// { -// System.err.println("Waiting for building menu to finish."); -// Thread.sleep(10); -// } catch (Exception e) -// { -// } -// } -// final AlignFrame me = this; -// buildingMenu = true; -// new Thread(new Runnable() -// { -// @Override -// public void run() -// { -// final List legacyItems = new ArrayList<>(); -// try -// { -// // 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; -// -// /* -// * do not i18n these strings - they are hard-coded in class -// * compbio.data.msa.Category, Jws2Discoverer.isRecalculable() and -// * SequenceAnnotationWSClient.initSequenceAnnotationWSClient() -// */ -// 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"); -// final JMenu dismenu = new JMenu("Protein Disorder"); -// // JAL-940 - only show secondary structure prediction services from -// // the legacy server -// 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 -// // No MSAWS used any more: -// // Vector msaws = null; // (Vector) -// // Discoverer.services.get("MsaWS"); -// Vector secstrpr = Discoverer.services -// .get("SecStrPred"); -// if (secstrpr != null) -// { -// // Add any secondary structure prediction services -// for (int i = 0, j = secstrpr.size(); i < j; i++) -// { -// final ext.vamsas.ServiceHandle sh = secstrpr.get(i); -// jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer -// .getServiceClient(sh); -// int p = secstrmenu.getItemCount(); -// impl.attachWSMenuEntry(secstrmenu, me); -// int q = secstrmenu.getItemCount(); -// for (int litm = p; litm < q; litm++) -// { -// legacyItems.add(secstrmenu.getItem(litm)); -// } -// } -// } -// } -// -// // Add all submenus in the order they should appear on the web -// // services menu -// wsmenu.add(msawsmenu); -// wsmenu.add(secstrmenu); -// wsmenu.add(dismenu); -// wsmenu.add(analymenu); -// // No search services yet -// // wsmenu.add(seqsrchmenu); -// -// javax.swing.SwingUtilities.invokeLater(new Runnable() -// { -// @Override -// 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(wsmenu.get(i)); -// } -// } -// else -// { -// webService.add(me.webServiceNoServices); -// } -// // TODO: move into separate menu builder class. -// boolean new_sspred = false; -// -// if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) -// { -// WSDiscovererI jws2servs = Jws2Discoverer.getDiscoverer(); -// if (jws2servs != null) -// { -// if (jws2servs.hasServices()) -// { -// jws2servs.attachWSMenuEntry(webService, me); -// for (ServiceWithParameters sv : jws2servs -// .getServices()) -// { -// if (sv.getName().toLowerCase().contains("jpred")) -// { -// for (JMenuItem jmi : legacyItems) -// { -// jmi.setVisible(false); -// } -// } -// } -// -// } -// if (jws2servs.isRunning()) -// { -// JMenuItem tm = new JMenuItem( -// "Still discovering JABA Services"); -// tm.setEnabled(false); -// webService.add(tm); -// } -// } -// } -// -// if (Cache.getDefault("SHOW_SLIVKA_SERVICES", true)) -// { -// WSDiscovererI discoverer = SlivkaWSDiscoverer -// .getInstance(); -// if (discoverer != null) -// { -// if (discoverer.hasServices()) -// { -// discoverer.attachWSMenuEntry(webService, me); -// } -// if (discoverer.isRunning()) -// { -// JMenuItem tm = new JMenuItem( -// "Still discovering Slivka Services"); -// tm.setEnabled(false); -// webService.add(tm); -// } -// } -// } -// -// build_urlServiceMenu(me.webService); -// build_fetchdbmenu(webService); -// for (JMenu item : wsmenu) -// { -// if (item.getItemCount() == 0) -// { -// item.setEnabled(false); -// } -// else -// { -// item.setEnabled(true); -// } -// } -// } catch (Exception e) -// { -// Cache.log.debug( -// "Exception during web service menu building process.", -// e); -// } -// } -// }); -// } catch (Exception e) -// { -// } -// buildingMenu = false; -// } -// }).start(); -// -// } - /** * construct any groupURL type service menu entries. * diff --git a/src/jalview/ws/jws1/Discoverer.java b/src/jalview/ws/jws1/Discoverer.java index 7ab8117..65d01b4 100644 --- a/src/jalview/ws/jws1/Discoverer.java +++ b/src/jalview/ws/jws1/Discoverer.java @@ -20,6 +20,7 @@ */ package jalview.ws.jws1; +import jalview.bin.Cache; import jalview.gui.JvOptionPane; import jalview.util.MessageManager; @@ -379,6 +380,7 @@ public class Discoverer implements Runnable @Override public void run() { + Cache.log.info("Discovering jws1 services"); Discoverer.doDiscovery(); discoverServices(); }