X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fstructures%2Fmodels%2FAAStructureBindingModel.java;h=1afa15e7673a9a992a60d268311aef9e7d533b84;hb=4ee3a368d2de9eaa050137f7d45cfac0c432ef53;hp=d92c78a841182343b77f7d201ef6833f520a2adc;hpb=d87b55e45cc1e6a5b7df3865ded1b87a0e3dc7ff;p=jalview.git diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index d92c78a..1afa15e 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -1058,16 +1058,16 @@ public abstract class AAStructureBindingModel private List executeCommand(StructureCommandI cmd, boolean getReply, String msg) { + final JalviewStructureDisplayI theViewer = getViewer(); + final long handle = msg == null ? 0 : theViewer.startProgressBar(msg); if (getReply) { /* * synchronous (same thread) execution so reply can be returned */ - final JalviewStructureDisplayI theViewer = getViewer(); - final long handle = msg == null ? 0 : theViewer.startProgressBar(msg); try { - return executeCommand(cmd, getReply); + return executeCommand(cmd, true); } finally { if (msg != null) @@ -1081,9 +1081,6 @@ public abstract class AAStructureBindingModel /* * asynchronous (new thread) execution if no reply needed */ - final JalviewStructureDisplayI theViewer = getViewer(); - final long handle = msg == null ? 0 : theViewer.startProgressBar(msg); - SwingUtilities.invokeLater(new Runnable() { @Override @@ -1116,8 +1113,7 @@ public abstract class AAStructureBindingModel boolean getReply); /** - * Executes one or more structure viewer commands. If a progress message is - * provided, it is shown first, and removed after all commands have been run. + * Executes one or more structure viewer commands * * @param commands * @param getReply @@ -1126,31 +1122,16 @@ public abstract class AAStructureBindingModel protected List executeCommands(List commands, boolean getReply, String msg) { - /* - * show progress message if specified - */ - final JalviewStructureDisplayI theViewer = getViewer(); - final long handle = msg == null ? 0 : theViewer.startProgressBar(msg); - List response = getReply ? new ArrayList<>() : null; - try - { - for (StructureCommandI cmd : commands) - { - List replies = executeCommand(cmd, getReply, null); - if (getReply && replies != null) - { - response.addAll(replies); - } - } - return response; - } finally + for (StructureCommandI cmd : commands) { - if (msg != null) + List replies = executeCommand(cmd, getReply, msg); + if (replies != null) { - theViewer.stopProgressBar(null, handle); + response.addAll(replies); } } + return response; } /** @@ -1168,7 +1149,7 @@ public abstract class AAStructureBindingModel List colourBySequenceCommands = commandGenerator .colourBySequence(colourMap); - executeCommands(colourBySequenceCommands, false, null); + executeCommands(colourBySequenceCommands, false, COLOURING_STRUCTURES); } /**