From cb6728561c51315bdd5a15558e6f43cb8dc5ffd0 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Thu, 30 Sep 2021 16:38:04 +0200 Subject: [PATCH] JAL-3878 Fetch sequences for alignment on menu action, not creation. --- src/jalview/ws2/operations/AlignmentOperation.java | 38 +++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) 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); } }); -- 1.7.10.2