From dad42ab3148494804b4c9d95bc416a7beb2a84dc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 11 Nov 2016 08:50:57 +0000 Subject: [PATCH] JAL-2295 (optionally) return Chimera command reply --- .../ext/rbvi/chimera/JalviewChimeraBinding.java | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 8601b1b..3d6e239 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -596,31 +596,40 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel } /** - * Send a command to Chimera, and optionally log any responses. + * Send a command to Chimera, and optionally log and return any responses * * @param command - * @param logResponse + * @param getResponse */ - public void sendChimeraCommand(final String command, boolean logResponse) + public List sendChimeraCommand(final String command, + boolean getResponse) { if (viewer == null) { // ? thread running after viewer shut down - return; + return null; } + List reply = null; viewerCommandHistory(false); if (lastCommand == null || !lastCommand.equals(command)) { // trim command or it may never find a match in the replyLog!! List lastReply = viewer.sendChimeraCommand(command.trim(), - logResponse); - if (logResponse && debug) + getResponse); + if (getResponse) { - log("Response from command ('" + command + "') was:\n" + lastReply); + reply = lastReply; + if (debug) + { + log("Response from command ('" + command + "') was:\n" + + lastReply); + } } } viewerCommandHistory(true); lastCommand = command; + + return reply; } /** -- 1.7.10.2