@Override
protected IStatus run(IProgressMonitor monitor) {
PyStackFrame frame = consoleFrame.getLastSelectedFrame();
if (frame == null) {
nextResponse = new InterpreterResponse(EMPTY,
"[Invalid Frame]: Please select frame to connect the console." + "\n", false, false);
return Status.CANCEL_STATUS;
}
final EvaluateDebugConsoleExpression evaluateDebugConsoleExpression = new EvaluateDebugConsoleExpression(
frame);
evaluateDebugConsoleExpression.executeCommand(command);
String result = evaluateDebugConsoleExpression.waitForCommand();
try {
if (result.length() == 0) {
//timed out
nextResponse = new InterpreterResponse(result, EMPTY, false, false);
return Status.CANCEL_STATUS;
} else {
EvaluateDebugConsoleExpression.PydevDebugConsoleMessage consoleMessage = XMLUtils
.getConsoleMessage(result);
nextResponse = new InterpreterResponse(consoleMessage.getOutputMessage().toString(),
consoleMessage.getErrorMessage().toString(), consoleMessage.isMore(), false);
}
} catch (CoreException e) {
Log.log(e);
nextResponse = new InterpreterResponse(result, EMPTY, false, false);
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}