use of com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceValue in project intellij-plugins by JetBrains.
the class DartVmServiceListener method evaluateExpression.
@Nullable
private String evaluateExpression(@NotNull final String isolateId, @Nullable final Frame vmTopFrame, @Nullable final XExpression xExpression) {
final String evalText = xExpression == null ? null : xExpression.getExpression();
if (vmTopFrame == null || StringUtil.isEmptyOrSpaces(evalText))
return null;
final Ref<String> evalResult = new Ref<>();
final Semaphore semaphore = new Semaphore();
semaphore.down();
myDebugProcess.getVmServiceWrapper().evaluateInFrame(isolateId, vmTopFrame, evalText, new XDebuggerEvaluator.XEvaluationCallback() {
@Override
public void evaluated(@NotNull final XValue result) {
if (result instanceof DartVmServiceValue) {
evalResult.set(getSimpleStringPresentation(((DartVmServiceValue) result).getInstanceRef()));
}
semaphore.up();
}
@Override
public void errorOccurred(@NotNull final String errorMessage) {
evalResult.set("Failed to evaluate log expression [" + evalText + "]: " + errorMessage);
semaphore.up();
}
});
semaphore.waitFor(1000);
return evalResult.get();
}
Aggregations