From: Jim Procter Date: Mon, 23 Sep 2019 08:15:32 +0000 (+0100) Subject: JAL-3070 match AbstractJabaCalcWorker’s annotation service interface with class from... X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=31ee6e439fa0e6432e812089e092df0cee1eb223;p=jalview.git JAL-3070 match AbstractJabaCalcWorker’s annotation service interface with class from the aaui field to enable/disable tick box --- diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java index 422b4ef..fae8089 100644 --- a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -39,6 +39,7 @@ import jalview.util.MessageManager; import jalview.workers.AlignCalcWorker; import jalview.ws.api.CancellableI; import jalview.ws.api.JobId; +import jalview.ws.api.SequenceAnnotationServiceI; import jalview.ws.api.WSAnnotationCalcManagerI; import jalview.ws.gui.AnnotationWsJob; import jalview.ws.jws2.dm.AAConSettings; @@ -763,4 +764,9 @@ public class AbstractJabaCalcWorker extends AlignCalcWorker } } + public SequenceAnnotationServiceI getService() + { + return annotService; + } + } diff --git a/src/jalview/ws/jws2/Jws2ClientFactory.java b/src/jalview/ws/jws2/Jws2ClientFactory.java index 4af8124..2a3b4a5 100644 --- a/src/jalview/ws/jws2/Jws2ClientFactory.java +++ b/src/jalview/ws/jws2/Jws2ClientFactory.java @@ -134,18 +134,28 @@ public class Jws2ClientFactory { aaConEnabled.setEnabled(false); modifyParams.setEnabled(false); + return; } List aaconClient = alignFrame.getViewport() - .getCalcManager() - .getRegisteredWorkersOfClass(aaui.getClient()); - if (aaconClient != null && aaconClient.size() > 0) - { - aaConEnabled.setSelected(true); - } - else + .getCalcManager().getRegisteredWorkersOfClass( + AbstractJabaCalcWorker.class); + + boolean serviceEnabled = false; + if (aaconClient != null) { - aaConEnabled.setSelected(false); + for (AlignCalcWorkerI _worker : aaconClient) + { + AbstractJabaCalcWorker worker = (AbstractJabaCalcWorker) _worker; + // this could be cleaner ? + if (worker.hasService() + && aaui.getClient() + .equals(worker.getService().getClass())) + { + serviceEnabled = true; + } + } } + aaConEnabled.setSelected(serviceEnabled); } @Override