private List<String> 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)
/*
* 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
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
protected List<String> executeCommands(List<StructureCommandI> commands,
boolean getReply, String msg)
{
- /*
- * show progress message if specified
- */
- final JalviewStructureDisplayI theViewer = getViewer();
- final long handle = msg == null ? 0 : theViewer.startProgressBar(msg);
-
List<String> response = getReply ? new ArrayList<>() : null;
- try
- {
- for (StructureCommandI cmd : commands)
- {
- List<String> replies = executeCommand(cmd, getReply, null);
- if (getReply && replies != null)
- {
- response.addAll(replies);
- }
- }
- return response;
- } finally
+ for (StructureCommandI cmd : commands)
{
- if (msg != null)
+ List<String> replies = executeCommand(cmd, getReply, msg);
+ if (replies != null)
{
- theViewer.stopProgressBar(null, handle);
+ response.addAll(replies);
}
}
+ return response;
}
/**
List<StructureCommandI> colourBySequenceCommands = commandGenerator
.colourBySequence(colourMap);
- executeCommands(colourBySequenceCommands, false, null);
+ executeCommands(colourBySequenceCommands, false, COLOURING_STRUCTURES);
}
/**