Merge branch 'mmw/JAL-4199-web-services-testing' into mmw/bug/JAL-4241-annotation...
[jalview.git] / src / jalview / ws2 / actions / BaseAction.java
index 97cf6fa..6e92f4c 100644 (file)
@@ -23,7 +23,7 @@ public abstract class BaseAction<R> implements ActionI<R>
   {
     protected WebService<A> webService;
 
-    protected String name;
+    protected String name = null;
 
     protected String tooltip = "";
 
@@ -116,7 +116,6 @@ public abstract class BaseAction<R> implements ActionI<R>
   {
     Objects.requireNonNull(builder.webService);
     this.webService = builder.webService;
-    Objects.requireNonNull(builder.name);
     this.name = builder.name;
     this.tooltip = builder.tooltip;
     this.subcategory = builder.subcategory;
@@ -139,6 +138,20 @@ public abstract class BaseAction<R> implements ActionI<R>
     return name;
   }
 
+  /**
+   * Returns a full name of the action which comprises of the service name and
+   * the action name if present.
+   * 
+   * @return full name of this action
+   */
+  public String getFullName()
+  {
+    if (name == null || name.isEmpty())
+      return webService.getName();
+    else
+      return webService.getName() + " " + name;
+  }
+
   @Override
   public String getTooltip()
   {