From: Mateusz Warowny Date: Wed, 10 May 2023 09:26:13 +0000 (+0200) Subject: JAL-3954 Register AlignFrame as web service change listener and add menus X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5f4f772b4ce40f2ea987cb03dd2c06ec1f48ba67;p=jalview.git JAL-3954 Register AlignFrame as web service change listener and add menus --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 63bbb72..8ae4601 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -183,6 +183,7 @@ import jalview.ws.params.ParamDatastoreI; import jalview.ws.params.WsParamSetI; import jalview.ws.seqfetcher.DbSourceProxy; import jalview.ws2.client.api.WebServiceDiscovererI; +import jalview.ws2.client.ebi.JobDispatcherWSDiscoverer; import jalview.ws2.client.slivka.SlivkaWSDiscoverer; import jalview.ws2.gui.WebServicesMenuManager; @@ -977,6 +978,15 @@ public class AlignFrame extends GAlignFrame menu.setNoServices(services.isEmpty() && discoverer.isDone()); }; + private WebServiceDiscovererI.ServicesChangeListener ebiServiceChangeListener = + (discoverer, services) -> { + // run when ebi services change + var menu = AlignFrame.this.ebiMenu; + menu.setServices(discoverer); + menu.setInProgress(discoverer.isRunning()); + menu.setNoServices(services.isEmpty() && discoverer.isDone()); + }; + /* Set up intrinsic listeners for dynamically generated GUI bits. */ private void addServiceListeners() { @@ -985,6 +995,10 @@ public class AlignFrame extends GAlignFrame WebServiceDiscovererI discoverer = SlivkaWSDiscoverer.getInstance(); discoverer.addServicesChangeListener(slivkaServiceChangeListener); } + if (Cache.getDefault("SHOW_EBI_SERVICES", true)) + { + JobDispatcherWSDiscoverer.getInstance().addServicesChangeListener(ebiServiceChangeListener); + } if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { WSDiscovererI discoverer = Jws2Discoverer.getInstance(); @@ -4657,6 +4671,7 @@ public class AlignFrame extends GAlignFrame } private WebServicesMenuManager slivkaMenu = new WebServicesMenuManager("slivka", this); + private WebServicesMenuManager ebiMenu = new WebServicesMenuManager("job dispatcher", this); /** * Schedule the web services menu rebuild to the event dispatch thread. @@ -4675,6 +4690,15 @@ public class AlignFrame extends GAlignFrame slivkaMenu.setNoServices(discoverer.isDone() && !discoverer.hasServices()); webService.add(slivkaMenu.getMenu()); } + if (Cache.getDefault("SHOW_EBI_SERVICES", true)) + { + Console.info("Building web services menu for jobs dispatcher"); + JobDispatcherWSDiscoverer discoverer = JobDispatcherWSDiscoverer.getInstance(); + ebiMenu.setServices(discoverer); + ebiMenu.setInProgress(discoverer.isRunning()); + ebiMenu.setNoServices(discoverer.isDone() && !discoverer.hasServices()); + webService.add(ebiMenu.getMenu()); + } if (Cache.getDefault("SHOW_JWS2_SERVICES", true)) { WSDiscovererI jws2servs = Jws2Discoverer.getInstance(); diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 0b639dd..02643ec 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -2742,6 +2742,11 @@ public class Desktop extends GDesktop tasks.add(jalview.ws2.client.slivka.SlivkaWSDiscoverer .getInstance().startDiscoverer()); } + if (Cache.getDefault("SHOW_EBI_SERVICES", true)) + { + tasks.add(jalview.ws2.client.ebi.JobDispatcherWSDiscoverer + .getInstance().startDiscoverer()); + } if (blocking) { for (Future task : tasks) {