List of usage examples for org.eclipse.jdt.core.dom ThisExpression getParent
public final ASTNode getParent()
null
if this is the root node. From source file:net.sf.j2s.core.astvisitors.ASTScriptVisitor.java
License:Open Source License
public boolean visit(ThisExpression node) { Name qualifier = node.getQualifier(); if (qualifier != null) { ASTNode xparent = node.getParent(); while (xparent != null && !(xparent instanceof AbstractTypeDeclaration) && !(xparent instanceof AnonymousClassDeclaration)) { xparent = xparent.getParent(); }// w w w .j a va 2s . co m if (xparent == null || xparent.getParent() == null // CompilationUnit || xparent.getParent().getParent() == null) { buffer.append("this"); } else { /* * only need callbacks wrapper in inner classes * or anonymous classes. */ buffer.append("this.callbacks[\""); qualifier.accept(this); buffer.append("\"]"); } } else { buffer.append("this"); } return false; }