JAL-3070 detect presence of existing JABA RNAAliFold client
authorJim Procter <jprocter@issues.jalview.org>
Mon, 23 Sep 2019 08:38:33 +0000 (09:38 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Mon, 23 Sep 2019 08:38:33 +0000 (09:38 +0100)
src/jalview/ws/jws2/SequenceAnnotationWSClient.java

index 493a73b..58478d6 100644 (file)
@@ -83,9 +83,24 @@ public class SequenceAnnotationWSClient extends Jws2Client
       // columns
 
       List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
-              .getCalcManager().getRegisteredWorkersOfClass(clientClass);
-      AbstractJabaCalcWorker worker;
-      if (clnts == null || clnts.size() == 0)
+              .getCalcManager()
+              .getRegisteredWorkersOfClass(AbstractJabaCalcWorker.class);
+
+      AbstractJabaCalcWorker worker = null;
+      if (clnts != null)
+      {
+        for (AlignCalcWorkerI _worker : clnts)
+        {
+          worker = (AbstractJabaCalcWorker) _worker;
+          if (worker.hasService()
+                  && worker.getService().getClass().equals(clientClass))
+          {
+            break;
+          }
+          worker = null;
+        }
+      }
+      if (worker == null)
       {
         if (!processParams(sh, editParams))
         {
@@ -108,7 +123,6 @@ public class SequenceAnnotationWSClient extends Jws2Client
       }
       else
       {
-        worker = (AbstractJabaCalcWorker) clnts.get(0);
         if (editParams)
         {
           paramset = worker.getArguments();