From: Mateusz Warowny Date: Thu, 30 Sep 2021 14:38:04 +0000 (+0200) Subject: JAL-3878 Fetch sequences for alignment on menu action, not creation. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=cb6728561c51315bdd5a15558e6f43cb8dc5ffd0;p=jalview.git JAL-3878 Fetch sequences for alignment on menu action, not creation. --- diff --git a/src/jalview/ws2/operations/AlignmentOperation.java b/src/jalview/ws2/operations/AlignmentOperation.java index 32a5abc..14564d6 100644 --- a/src/jalview/ws2/operations/AlignmentOperation.java +++ b/src/jalview/ws2/operations/AlignmentOperation.java @@ -156,9 +156,6 @@ public class AlignmentOperation implements Operation final String action = submitGaps ? "Align" : "Realign"; final var calcName = service.getName(); - final AlignmentView msa = frame.gatherSequencesForAlignment(); - final AlignViewport viewport = frame.getViewport(); - final AlignmentI alignment = frame.getViewport().getAlignment(); String title = frame.getTitle(); WebServiceExecutor executor = frame.getViewport().getWSExecutor(); { @@ -167,11 +164,14 @@ public class AlignmentOperation implements Operation item.setToolTipText(MessageManager .formatMessage("label.action_with_default_settings", action)); item.addActionListener((event) -> { + final AlignmentView msa = frame.gatherSequencesForAlignment(); + final AlignViewport viewport = frame.getViewport(); + final AlignmentI alignment = frame.getViewport().getAlignment(); if (msa != null) { WebServiceWorkerI worker = new AlignmentWorker(msa, - Collections.emptyList(), title, submitGaps, true, - alignment, viewport); + Collections.emptyList(), title, submitGaps, true, + alignment, viewport); executor.submit(worker); } }); @@ -185,18 +185,21 @@ public class AlignmentOperation implements Operation item.setToolTipText(MessageManager.getString( "label.view_and_change_parameters_before_alignment")); item.addActionListener((event) -> { + final AlignmentView msa = frame.gatherSequencesForAlignment(); + final AlignViewport viewport = frame.getViewport(); + final AlignmentI alignment = frame.getViewport().getAlignment(); if (msa != null) { openEditParamsDialog(service, null, null) - .thenAcceptAsync((arguments) -> { - if (arguments != null) - { - WebServiceWorkerI worker = new AlignmentWorker(msa, - arguments, title, submitGaps, true, alignment, - viewport); - executor.submit(worker); - } - }); + .thenAcceptAsync((arguments) -> { + if (arguments != null) + { + WebServiceWorkerI worker = new AlignmentWorker(msa, + arguments, title, submitGaps, true, alignment, + viewport); + executor.submit(worker); + } + }); } }); parent.add(item); @@ -235,11 +238,14 @@ public class AlignmentOperation implements Operation preset.getDescription())); item.setToolTipText(tooltip); item.addActionListener((event) -> { + final AlignmentView msa = frame.gatherSequencesForAlignment(); + final AlignViewport viewport = frame.getViewport(); + final AlignmentI alignment = frame.getViewport().getAlignment(); if (msa != null) { WebServiceWorkerI worker = new AlignmentWorker(msa, - preset.getArguments(), title, submitGaps, true, - alignment, viewport); + preset.getArguments(), title, submitGaps, true, + alignment, viewport); executor.submit(worker); } });