From 5e961ebc9a219d2e19341c0fc954f358699d3e20 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Mon, 11 Apr 2022 18:11:23 +0200 Subject: [PATCH] JAL-3878 Add full name getter to ActionI --- src/jalview/ws2/actions/api/ActionI.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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. * -- 1.7.10.2