*/
private static <NODETYPE extends ASTNode> Option<NODETYPE>
findNodeForModel(IMember model_element, final Class<? extends NODETYPE> clazz,
final Lambda<NODETYPE,Boolean> isCorrectNode) {
ICompilationUnit comp_unit = model_element.getCompilationUnit();
ASTNode node = getASTNodeFromCompilationUnit(comp_unit);
// Now, find the corresponding type node
final Box<NODETYPE> result = new Box<NODETYPE>(null);
node.accept(new ASTVisitor() {
@Override
public void postVisit(ASTNode node) {
// If this node is a subtype of the node we are
// interested in, then we can ask the client's
// function if this is the right instance.
if( clazz.isAssignableFrom(node.getClass()) ) {
@SuppressWarnings("unchecked") NODETYPE node2 = (NODETYPE)node;
if( isCorrectNode.call(node2) ) {
result.setValue(node2);
}
}