IType type = JdtUtils.getJavaType(file.getProject(), target);
if ("class-a".equals(nodeName) || "class-b".equals(nodeName) || "a-hint".equals(attrName) || "b-hint".equals(attrName) || "a-deep-index-hint".equals(attrName) || "b-deep-index-hint".equals(attrName)) {
//make a simple hyperlink to the class
if (type != null) {
return new JavaElementHyperlink(hyperlinkRegion, type);
}
} else if ("set-method".equals(attrName) || "get-method".equals(attrName) || "map-set-method".equals(attrName) || "map-get-method".equals(attrName) ) {
if ("field".equals(nodeName)) {
String targetClassName = DozerPluginUtils.getMappingClassName(node);
//get the first method that matches and make a hyperlink to that
if (targetClassName != null) {
IType targetClass = JdtUtils.getJavaType(file.getProject(), targetClassName);
IMethod method = getMethodFromType(targetClass, target);
if (method != null) {
return new JavaElementHyperlink(hyperlinkRegion, method);
}
}
}
} else if ("a-hint".equals(attrName) || "b-hint".equals(attrName)) {
//make a simple hyperlink to the class
if (parentNode.getParentNode() != null && "mapping".equals(parentNode.getParentNode().getNodeName())) {
if (type != null) {
return new JavaElementHyperlink(hyperlinkRegion, type);
}
}
} else if ("custom-converter".equals(attrName)) {
//make a simple hyperlink to the class
if (type != null) {
return new JavaElementHyperlink(hyperlinkRegion, type);
}
} else if ("custom-converter-id".equals(attrName)) {
//search spring-bean that uses our mapping file and return the mapping
//for the customconverter-id map-property
ISourceModelElement modelElement = getModelElementForCustomConverter(BeansEditorUtils.getFile(document), target);
if (modelElement != null) {
return new SourceModelHyperlink(modelElement, hyperlinkRegion);
}
} else if ("a".equals(nodeName) || "b".equals(nodeName) ) {
String targetClassName = DozerPluginUtils.getMappingClassName(node.getParentNode());
String property = node.getNodeValue();
if (targetClassName != null) {
IType targetClass = JdtUtils.getJavaType(file.getProject(), targetClassName);
try {
//if we are doing indexed property mapping, we remove the []
property = property.replaceAll("\\[\\]", "");
IMethod method = Introspector.getReadableProperty(targetClass, property);
if (method != null)
return new JavaElementHyperlink(hyperlinkRegion, method);
} catch (Throwable e) {
Logger.logException(e);
}
}
} else if ("bean-factory".equals(attrName)) {
//make a simple hyperlink to the class
if (type != null) {
return new JavaElementHyperlink(hyperlinkRegion, type);
}
}
return null;
}