From: Mateusz Warowny Date: Mon, 11 Apr 2022 16:11:23 +0000 (+0200) Subject: JAL-3878 Add full name getter to ActionI X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5e961ebc9a219d2e19341c0fc954f358699d3e20;p=jalview.git JAL-3878 Add full name getter to ActionI --- diff --git a/src/jalview/ws2/actions/api/ActionI.java b/src/jalview/ws2/actions/api/ActionI.java index bcf7678..52d70df 100644 --- a/src/jalview/ws2/actions/api/ActionI.java +++ b/src/jalview/ws2/actions/api/ActionI.java @@ -3,6 +3,8 @@ package jalview.ws2.actions.api; import java.util.EnumSet; import java.util.List; +import javax.swing.Icon; + import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ArgumentI; import jalview.ws2.api.CredentialType; @@ -43,6 +45,21 @@ public interface ActionI String getName(); /** + * Get the full name of the action consisting of the service name and the + * action name if present. + * + * @return full name of this action + */ + default String getFullName() + { + var name = getName(); + if (name == null || name.isEmpty()) + return getWebService().getName(); + else + return getWebService().getName() + " " + name; + } + + /** * Get the tooltip for the action which contains extra details about the * action. *