}
return true;
}
public void run(IJavaThread thread, IProgressMonitor monitor) {
IJavaObject codeSnippetInstance = null;
try {
codeSnippetInstance = newInstance(getCodeSnippetClassName());
initializeLocals(codeSnippetInstance);
codeSnippetInstance.sendMessage(RUN_METHOD, "()V", null, getThread(), false); //$NON-NLS-1$
restoreLocals(codeSnippetInstance);
// now retrieve the description of the result
IVariable[] fields = codeSnippetInstance.getVariables();
IJavaVariable resultValue = null;
IJavaVariable resultType = null;
for (IVariable field : fields) {
if (field.getName().equals(RESULT_TYPE_FIELD)) {
resultType = (IJavaVariable) field;
}
if (field.getName().equals(RESULT_VALUE_FIELD)) {
resultValue = (IJavaVariable) field;
}
}
IJavaValue result = convertResult((IJavaClassObject) resultType.getValue(), (IJavaValue) resultValue.getValue());
getResult().setValue(result);
} catch (DebugException e) {
getResult().setException(e);
Throwable underlyingException = e.getStatus().getException();
if (underlyingException instanceof InvocationException) {
ObjectReference theException = ((InvocationException) underlyingException)
.exception();
if (theException != null) {
try {
try {
IJavaObject v = (IJavaObject) JDIValue.createValue(
(JDIDebugTarget) getDebugTarget(),
theException);
v.sendMessage(
"printStackTrace", "()V", null, getThread(), false); //$NON-NLS-2$ //$NON-NLS-1$
} catch (DebugException de) {
JDIDebugPlugin.log(de);
}
} catch (RuntimeException re) {