JAL-3878 Make interactive service arguments persistent between starts.
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Thu, 21 Oct 2021 15:02:47 +0000 (17:02 +0200)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Thu, 21 Oct 2021 15:02:47 +0000 (17:02 +0200)
src/jalview/ws2/operations/AnnotationOperation.java

index 884d327..55ed03b 100644 (file)
@@ -1,5 +1,6 @@
 package jalview.ws2.operations;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CompletionStage;
@@ -188,6 +189,7 @@ public class AnnotationOperation implements Operation
   {
     final var calcName = service.getName();
     final var calcManager = frame.getViewport().getCalcManager();
+    final var arguments = new ArrayList<ArgumentI>();
     final JCheckBoxMenuItem runItem;
     {
       // TODO use MessageManager and set tool tip text
@@ -195,7 +197,7 @@ public class AnnotationOperation implements Operation
           String.format("%s calculations", calcName));
       runItem.addActionListener((event) -> {
         calcManager.removeWorkersForName(calcName);
-        var worker = createWorker(Collections.emptyList(), frame, calcManager);
+        var worker = createWorker(arguments, frame, calcManager);
         calcManager.registerWorker(worker);
       });
       parent.add(runItem);
@@ -208,9 +210,11 @@ public class AnnotationOperation implements Operation
           String.format("Edit %s settings", calcName));
       _editItem.addActionListener((event) -> {
         openEditParamsDialog(service, null, null)
-            .thenAcceptAsync((arguments) -> {
+            .thenAcceptAsync((args) -> {
               if (arguments != null)
               {
+                arguments.clear();
+                arguments.addAll(args);
                 calcManager.removeWorkersForName(calcName);
                 var worker = createWorker(arguments, frame, calcManager);
                 calcManager.registerWorker(worker);