public String getReference() throws Exception {
return getReference(m_javaInfo);
}
public static String getReference(JavaInfo javaInfo) throws Exception {
VariableSupport variableSupport = javaInfo.getVariableSupport();
// handle this
if (variableSupport instanceof ThisVariableSupport) {
return "this";
}
// handle named variable
if (variableSupport instanceof AbstractSimpleVariableSupport && variableSupport.hasName()) {
return variableSupport.getName();
}
// handle exposed
if (variableSupport instanceof ExposedPropertyVariableSupport
|| variableSupport instanceof ExposedFieldVariableSupport) {
try {
for (ASTNode node : javaInfo.getRelatedNodes()) {
if (AstNodeUtils.isVariable(node)) {
return CoreUtils.getNodeReference(node);
}
}
} catch (Throwable e) {
}
String reference = getReference(javaInfo.getParentJava());
if (reference != null) {
return reference + "." + variableSupport.getTitle();
}
}
return null;
}