List of usage examples for org.eclipse.jdt.core.dom SuperMethodInvocation setQualifier
public void setQualifier(Name name)
From source file:java5totext.input.JDTVisitor.java
License:Open Source License
@Override public void endVisit(org.eclipse.jdt.core.dom.SuperMethodInvocation node) { SuperMethodInvocation element = (SuperMethodInvocation) this.binding.get(node); this.initializeNode(element, node); for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) { Expression itElement = (Expression) this.binding.get(i.next()); if (itElement != null) element.getArguments().add(itElement); }//from w w w .ja v a2s . c o m if (this.binding.get(node.getName()) != null) element.setMethod((NamedElementRef) this.binding.get(node.getName())); if (this.binding.get(node.getQualifier()) != null) element.setQualifier((NamedElementRef) this.binding.get(node.getQualifier())); }
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
public Expression convert(MessageSend expression) { // will return a MethodInvocation or a SuperMethodInvocation or Expression expr;//w w w.j ava2 s . c o m int sourceStart = expression.sourceStart; if (expression.isSuperAccess()) { // returns a SuperMethodInvocation final SuperMethodInvocation superMethodInvocation = new SuperMethodInvocation(this.ast); if (this.resolveBindings) { recordNodes(superMethodInvocation, expression); } final SimpleName name = new SimpleName(this.ast); name.internalSetIdentifier(new String(expression.selector)); int nameSourceStart = (int) (expression.nameSourcePosition >>> 32); int nameSourceLength = ((int) expression.nameSourcePosition) - nameSourceStart + 1; name.setSourceRange(nameSourceStart, nameSourceLength); if (this.resolveBindings) { recordNodes(name, expression); } superMethodInvocation.setName(name); // expression.receiver is either a QualifiedSuperReference or a SuperReference // so the casting cannot fail if (expression.receiver instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) { Name qualifier = convert( (org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) expression.receiver); superMethodInvocation.setQualifier(qualifier); if (this.resolveBindings) { recordNodes(qualifier, expression.receiver); } if (qualifier != null) { sourceStart = qualifier.getStartPosition(); } } org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = expression.arguments; if (arguments != null) { int argumentsLength = arguments.length; for (int i = 0; i < argumentsLength; i++) { Expression expri = convert(arguments[i]); if (this.resolveBindings) { recordNodes(expri, arguments[i]); } superMethodInvocation.arguments().add(expri); } } final TypeReference[] typeArguments = expression.typeArguments; if (typeArguments != null) { switch (this.ast.apiLevel) { case AST.JLS2_INTERNAL: superMethodInvocation.setFlags(superMethodInvocation.getFlags() | ASTNode.MALFORMED); break; default: for (int i = 0, max = typeArguments.length; i < max; i++) { superMethodInvocation.typeArguments().add(convertType(typeArguments[i])); } break; } } expr = superMethodInvocation; } else { // returns a MethodInvocation final MethodInvocation methodInvocation = new MethodInvocation(this.ast); if (this.resolveBindings) { recordNodes(methodInvocation, expression); } final SimpleName name = new SimpleName(this.ast); name.internalSetIdentifier(new String(expression.selector)); int nameSourceStart = (int) (expression.nameSourcePosition >>> 32); int nameSourceLength = ((int) expression.nameSourcePosition) - nameSourceStart + 1; name.setSourceRange(nameSourceStart, nameSourceLength); methodInvocation.setName(name); if (this.resolveBindings) { recordNodes(name, expression); } org.eclipse.jdt.internal.compiler.ast.Expression[] arguments = expression.arguments; if (arguments != null) { int argumentsLength = arguments.length; for (int i = 0; i < argumentsLength; i++) { Expression expri = convert(arguments[i]); if (this.resolveBindings) { recordNodes(expri, arguments[i]); } methodInvocation.arguments().add(expri); } } Expression qualifier = null; org.eclipse.jdt.internal.compiler.ast.Expression receiver = expression.receiver; if (receiver instanceof MessageSend) { if ((receiver.bits & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) != 0) { qualifier = convertToParenthesizedExpression(receiver); } else { qualifier = convert((MessageSend) receiver); } } else { qualifier = convert(receiver); } if (qualifier instanceof Name && this.resolveBindings) { recordNodes(qualifier, receiver); } methodInvocation.setExpression(qualifier); if (qualifier != null) { sourceStart = qualifier.getStartPosition(); } final TypeReference[] typeArguments = expression.typeArguments; if (typeArguments != null) { switch (this.ast.apiLevel) { case AST.JLS2_INTERNAL: methodInvocation.setFlags(methodInvocation.getFlags() | ASTNode.MALFORMED); break; default: for (int i = 0, max = typeArguments.length; i < max; i++) { methodInvocation.typeArguments().add(convertType(typeArguments[i])); } break; } } expr = methodInvocation; } expr.setSourceRange(sourceStart, expression.sourceEnd - sourceStart + 1); removeTrailingCommentFromExpressionEndingWithAParen(expr); return expr; }
From source file:org.eclipse.modisco.java.discoverer.internal.io.java.JDTVisitor.java
License:Open Source License
@Override public void endVisit(final org.eclipse.jdt.core.dom.SuperMethodInvocation node) { SuperMethodInvocation element = (SuperMethodInvocation) this.binding.get(node); initializeNode(element, node);//www. jav a2 s .c o m ASTNode modiscoNode = null; for (Iterator<?> i = node.arguments().iterator(); i.hasNext();) { ASTNode itElement = this.binding.get(i.next()); if (itElement != null) { element.getArguments().add(JDTVisitorUtils.completeExpression(itElement, this)); } } for (Iterator<?> i = node.typeArguments().iterator(); i.hasNext();) { ASTNode itElement = this.binding.get(i.next()); if (itElement != null) { element.getTypeArguments().add(JDTVisitorUtils.completeTypeAccess(itElement, this)); } } modiscoNode = this.binding.get(node.getName()); if (JDTVisitorUtils.completeBinding(element, modiscoNode, "method")) { //$NON-NLS-1$ element.setMethod((AbstractMethodDeclaration) modiscoNode); } if (this.binding.get(node.getQualifier()) != null) { element.setQualifier(JDTVisitorUtils.completeTypeAccess(this.binding.get(node.getQualifier()), this)); } }
From source file:org.whole.lang.java.util.JDTTransformerVisitor.java
License:Open Source License
public boolean visit(SuperMethodInvocation node) { org.whole.lang.java.model.SuperMethodInvocation callExp = lf .create(JavaEntityDescriptorEnum.SuperMethodInvocation); if (acceptChild(node.getQualifier())) callExp.setQualifier(name); acceptChild(node.getName());//from w w w . jav a 2 s . com callExp.setName((org.whole.lang.java.model.SimpleName) name); Arguments arguments; callExp.setArguments(arguments = lf.create(JavaEntityDescriptorEnum.Arguments)); Iterator<?> i = node.arguments().iterator(); while (i.hasNext()) { ((ASTNode) i.next()).accept(this); arguments.wAdd(exp); } exp = callExp; return false; }