refs #7458
Change-Id: I5cd30ed29229147b2dd1adf3862f1cd2cea99f60
}
SingleElementNode getSingleElementNode() {
- return (SingleElementNode)NodeUtil.getNearestParentOfType(this, SingleElementNode.class);
+ return (SingleElementNode)NodeUtil.getPossibleNearestParentOfType(this, SingleElementNode.class);
}
@Override
}
}
+ public static INode getPossibleNearestParentOfType(INode node, Class<?> clazz) {
+ ParentNode<?> parent = null;
+ while (true) {
+ parent = node.getParent();
+ if (parent == null)
+ return null;
+ node = parent;
+ if (clazz.isInstance(node))
+ return node;
+ }
+ }
+
public static INode getRootNode(INode node) {
ParentNode<?> parent = null;
while (true) {