Example usage for org.eclipse.jdt.core.dom SuperMethodInvocation getRoot

List of usage examples for org.eclipse.jdt.core.dom SuperMethodInvocation getRoot

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SuperMethodInvocation getRoot.

Prototype

public final ASTNode getRoot() 

Source Link

Document

Returns the root node at or above this node; returns this node if it is a root.

Usage

From source file:org.eclipse.wb.internal.core.eval.evaluators.InvocationEvaluator.java

License:Open Source License

private Object evaluate(EvaluationContext context, SuperMethodInvocation invocation) throws Exception {
    // prepare target
    Object thisValue = AstEvaluationEngine.evaluate(context, null);
    // prepare method
    Method method;/* www . j  a va  2  s  . c  om*/
    {
        IMethodBinding methodBinding = AstNodeUtils.getMethodBinding(invocation);
        Assert.isNotNull(methodBinding);
        method = getReflectionMethod(thisValue.getClass(), methodBinding);
    }
    // prepare argument values
    Object[] argumentValues = getArgumentValues(context, DomGenerics.arguments(invocation), true);
    // invoke method
    try {
        invocation.getRoot().setProperty(SUPER_MI_KEY, Boolean.TRUE);
        return method.invoke(thisValue, argumentValues);
    } catch (Throwable e) {
        throw new DesignerException(ICoreExceptionConstants.EVAL_SUPER_METHOD, e, context.getSource(invocation),
                method.toString(), getArguments_toString(argumentValues),
                AstEvaluationEngine.getUserStackTrace(e));
    }
}