本文整理汇总了Java中org.eclipse.debug.core.DebugException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java DebugException.getCause方法的具体用法?Java DebugException.getCause怎么用?Java DebugException.getCause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.debug.core.DebugException
的用法示例。
在下文中一共展示了DebugException.getCause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: watchEvaluationFinished
import org.eclipse.debug.core.DebugException; //导入方法依赖的package包/类
@Override
public void watchEvaluationFinished(IWatchExpressionResult result) {
IJavaValue ret = (IJavaValue) result.getValue();
DebugException exception = result.getException();
if(ret != null) {
if(ret instanceof IJavaObject) {
IJavaObject obj = (IJavaObject) ret;
if(obj.isNull()) {
listener.valueReturn(null);
}
else {
IEntityModel object = getRuntimeModel().getObject((IJavaObject) ret, true, null);
listener.valueReturn(object);
}
}
else
listener.valueReturn(ret);
}
else if(exception != null) {
String trimExpression = trimExpression(expression);
InvocationException cause = (InvocationException) exception.getCause();
// cause.printStackTrace();
// ObjectReference exception2 = cause.exception();
ReferenceType referenceType = cause.exception().referenceType();
// Field field = referenceType.fieldByName("NULL_CAUSE_MESSAGE");
// StackTraceElement[] stackTrace = ((InvocationException)exception.getCause()).getStackTrace();
// String message = ((InvocationException)exception.getCause()).getMessage();
// System.out.println(message);
// System.out.println(stackTrace[0].getClassName() + " " + stackTrace[0].getLineNumber());
String exceptionType = ((InvocationException)exception.getCause()).exception().referenceType().name();
PandionJUI.executeUpdate(() -> {
if(exceptionType.equals(IllegalArgumentException.class.getName()))
MessageDialog.openError(Display.getDefault().getActiveShell(), "Illegal arguments",
trimExpression + " was invoked with illegal argument values.");
else if(exceptionType.equals(IllegalStateException.class.getName()))
MessageDialog.openError(Display.getDefault().getActiveShell(), "Illegal object state",
"the current state of the object does not allow the operation " + trimExpression);
else
MessageDialog.openError(Display.getDefault().getActiveShell(), "Exception occurred", exceptionType +
"\nSuggestion: execute " + trimExpression + " through code statements step by step.");
});
}
}