private int determineVote(IEvaluationResult result) {
if (result.isTerminated()) {
// indicates the user terminated the evaluation
return SUSPEND;
}
JDIThread thread = (JDIThread) result.getThread();
if (result.hasErrors()) {
DebugException exception = result.getException();
Throwable wrappedException = exception.getStatus()
.getException();
if (wrappedException instanceof VMDisconnectedException) {
// VM terminated/disconnected during evaluation
return DONT_SUSPEND;
}
fireConditionHasRuntimeErrors(fBreakpoint, exception);
return SUSPEND;
}
try {
IValue value = result.getValue();
if (fBreakpoint.isConditionSuspendOnTrue()) {
if (value instanceof IJavaPrimitiveValue) {
// Suspend when the condition evaluates true
IJavaPrimitiveValue javaValue = (IJavaPrimitiveValue) value;
if (javaValue.getJavaType().getName()
.equals("boolean")) { //$NON-NLS-1$
if (javaValue.getBooleanValue()) {
return SUSPEND;
}
return DONT_SUSPEND;
}
}
IStatus status = new Status(
IStatus.ERROR,
JDIDebugPlugin.getUniqueIdentifier(),
MessageFormat.format(JDIDebugBreakpointMessages.ConditionalBreakpointHandler_1, value.getReferenceTypeName()));
// result was not boolean
fireConditionHasRuntimeErrors(fBreakpoint, new DebugException(status));
return SUSPEND;
}
IDebugTarget debugTarget = thread.getDebugTarget();
IValue lastValue = fBreakpoint
.setCurrentConditionValue(debugTarget, value);
if (!value.equals(lastValue)) {
return SUSPEND;
}