JAL-3066 Sequence annotation services.
[jalview.git] / src / jalview / ws / jws2 / SequenceAnnotationWSClient.java
index 7163974..a2038f0 100644 (file)
@@ -52,7 +52,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
     // TODO Auto-generated constructor stub
   }
 
-  public SequenceAnnotationWSClient(final Jws2Instance sh,
+  public SequenceAnnotationWSClient(final ServiceWithParameters sh,
           AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
   {
     super(alignFrame, preset, null);
@@ -139,7 +139,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
         worker.updateParameters(this.preset, paramset);
       }
     }
-    if (sh.getAction().toLowerCase().contains("disorder"))
+    if (!sh.isInteractiveUpdate())
     {
       // build IUPred style client. take sequences, returns annotation per
       // sequence.
@@ -172,16 +172,19 @@ public class SequenceAnnotationWSClient extends Jws2Client
           final ServiceWithParameters service,
           final AlignFrame alignFrame)
   {
-    if (Jws2ClientFactory.registerAAConWSInstance(wsmenu, service,
-            alignFrame))
+    if (service instanceof Jws2Instance
+        && Jws2ClientFactory.registerAAConWSInstance(wsmenu, (Jws2Instance) service, alignFrame))
     {
       // Alignment dependent analysis calculation WS gui
       return;
     }
     boolean hasparams = service.hasParameters();
-    // Assume name ends in WS
-    String calcName = service.getName().substring(0,
-            service.getName().length() - 2);
+    String calcName = service.getName();
+    if (calcName.endsWith("WS"))
+    {
+      // Remove "WS" suffix
+      calcName = calcName.substring(0, calcName.length() - 2);
+    }
 
     JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage(
             "label.calcname_with_default_settings", new String[]
@@ -192,7 +195,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
       @Override
       public void actionPerformed(ActionEvent e)
       {
-        new SequenceAnnotationWSClient((Jws2Instance) service, alignFrame,
+        new SequenceAnnotationWSClient(service, alignFrame,
                 null, false);
       }
     });
@@ -211,7 +214,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
         @Override
         public void actionPerformed(ActionEvent e)
         {
-          new SequenceAnnotationWSClient((Jws2Instance) service, alignFrame,
+          new SequenceAnnotationWSClient(service, alignFrame,
                   null, true);
         }
       });
@@ -237,7 +240,7 @@ public class SequenceAnnotationWSClient extends Jws2Client
             @Override
             public void actionPerformed(ActionEvent e)
             {
-              new SequenceAnnotationWSClient((Jws2Instance) service,
+              new SequenceAnnotationWSClient(service,
                       alignFrame, preset,
                       false);
             }