if (d == null) return;
JPDAThread t = d.getCurrentThread();
if (t == null || !t.isSuspended()) return ;
String toolTipText = null;
try {
Variable v = null;
List<Operation> operations = t.getLastOperations();
if (operations != null) {
for (Operation operation: operations) {
if (!expression.endsWith(operation.getMethodName())) {
continue;
}
if (operation.getMethodStartPosition().getOffset() <= offset &&
offset <= operation.getMethodEndPosition().getOffset()) {
v = operation.getReturnValue();
}
}
}
if (v == null) {
v = d.evaluate (expression);
}
String type = v.getType ();
if (v instanceof ObjectVariable)
try {
String toString = null;
try {
java.lang.reflect.Method toStringMethod =
v.getClass().getMethod("getToStringValue", // NOI18N
new Class[] { Integer.TYPE });
toStringMethod.setAccessible(true);
toString = (String) toStringMethod.invoke(v, TO_STRING_LENGTH_LIMIT);
} catch (Exception ex) {
ex.printStackTrace();
}
if (toString == null) {
toString = ((ObjectVariable) v).getToStringValue();
}
toolTipText = expression + " = " +
(type.length () == 0 ?
"" :
"(" + type + ") ") +
toString;
} catch (InvalidExpressionException ex) {
toolTipText = expression + " = " +
(type.length () == 0 ?
"" :
"(" + type + ") ") +
v.getValue ();
}
else
toolTipText = expression + " = " +
(type.length () == 0 ?
"" :
"(" + type + ") ") +
v.getValue ();
} catch (InvalidExpressionException e) {
toolTipText = expression + " = >" + e.getMessage () + "<";
}
firePropertyChange (PROP_SHORT_DESCRIPTION, null, toolTipText);
}