private IResourceModelElement getResourceModelElementFromNode(Node n) {
if (n instanceof IDOMNode) {
IDOMNode domNode = ((IDOMNode) n);
int startLine = domNode.getStructuredDocument().getLineOfOffset(domNode.getStartOffset()) + 1;
int endLine = domNode.getStructuredDocument().getLineOfOffset(domNode.getStartOffset()) + 1;
IModelElement modelElement = BeansModelUtils.getMostSpecificModelElement(startLine, endLine,
(IFile) beansConfig.getElementResource(), null);
if (modelElement instanceof IResourceModelElement) {
return (IResourceModelElement) modelElement;
}
}