JAL-3070 match AbstractJabaCalcWorker’s annotation service interface with class from...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 23 Sep 2019 08:15:32 +0000 (09:15 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 23 Sep 2019 08:15:32 +0000 (09:15 +0100)
src/jalview/ws/jws2/AbstractJabaCalcWorker.java
src/jalview/ws/jws2/Jws2ClientFactory.java

index 422b4ef..fae8089 100644 (file)
@@ -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;
+  }
+
 }
index 4af8124..2a3b4a5 100644 (file)
@@ -134,18 +134,28 @@ public class Jws2ClientFactory
           {
             aaConEnabled.setEnabled(false);
             modifyParams.setEnabled(false);
+            return;
           }
           List<AlignCalcWorkerI> 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