X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fws2%2Factions%2Fapi%2FActionI.java;h=e84fd58d21ad4bc7c31fb236106045775542f5cd;hb=4df015be529a2e1b12c6b82b061798e186cc154b;hp=bcf7678da8a55d3e9d2499af6229d90906d58b6e;hpb=6ed95e10095d9b0a31fe6912818fb81d980fdc05;p=jalview.git diff --git a/src/jalview/ws2/actions/api/ActionI.java b/src/jalview/ws2/actions/api/ActionI.java index bcf7678..e84fd58 100644 --- a/src/jalview/ws2/actions/api/ActionI.java +++ b/src/jalview/ws2/actions/api/ActionI.java @@ -3,6 +3,9 @@ package jalview.ws2.actions.api; import java.util.EnumSet; import java.util.List; +import javax.swing.Icon; + +import jalview.api.AlignViewportI; import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ArgumentI; import jalview.ws2.api.CredentialType; @@ -43,6 +46,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. * @@ -98,10 +116,8 @@ public interface ActionI EnumSet getRequiredCredentials(); /** - * Run the action, create and start a new task with provided viewport, - * arguments and credentials and attach the handler to the task. The - * implementations of this method are responsible for starting the task using - * execution method appropriate for the action class. + * Create a new task with provided viewport, arguments and credentials ready + * to be started. * * @param viewport * current alignment viewport @@ -109,12 +125,10 @@ public interface ActionI * job parameters appropriate for the service * @param credentials * optional user credentials - * @param handler - * event handler attached to the new task - * @return new running task + * @return new task */ - TaskI perform(AlignmentViewport viewport, List args, - Credentials credentials, TaskEventListener handler); + TaskI createTask(AlignViewportI viewport, List args, + Credentials credentials); /** * Return if the action is currently active for the given viewport. Active