Example usage for org.eclipse.jdt.core.dom ThisExpression getQualifier

List of usage examples for org.eclipse.jdt.core.dom ThisExpression getQualifier

Introduction

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

Prototype

public Name getQualifier() 

Source Link

Document

Returns the qualifier of this "this" expression, or null if there is none.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(ThisExpression node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.fBuffer.append(".");//$NON-NLS-1$
    }// ww w.j  a  va2  s .  co  m
    this.fBuffer.append("this");//$NON-NLS-1$
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(ThisExpression node) {
    boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder();
    //      b.setPosition(pos.build());
    String name = "";
    if (node.getQualifier() != null)
        name += node.getQualifier().getFullyQualifiedName() + ".";
    b.setKind(boa.types.Ast.Expression.ExpressionKind.LITERAL);
    b.setLiteral(name + "this");
    expressions.push(b.build());//  w w  w  . j a  va  2  s  .com
    return false;
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(ThisExpression node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        this.buffer.append(".");//$NON-NLS-1$
    }//from   w  w  w .  j  a  v  a2 s  .c  om
    this.buffer.append("this");//$NON-NLS-1$
    return false;
}

From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java

License:Apache License

@Override
public boolean visit(ThisExpression node) {
    if (node.getQualifier() != null) {
        node.getQualifier().accept(this);
        sb.print(".");
    }//  w  ww  . j  av  a2  s  . co  m
    sb.print("this");
    return false;
}

From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java

License:Apache License

/** Visitor method for {@link ThisExpression}s. */
@Override/*from   ww  w  .j  a  v a  2 s.  c  om*/
public boolean visit(ThisExpression node) {
    sync(node);
    if (node.getQualifier() != null) {
        builder.open(plusFour);
        node.getQualifier().accept(this);
        builder.breakOp();
        token(".");
        builder.close();
    }
    token("this");
    return false;
}

From source file:com.ibm.wala.cast.java.translator.jdt.JDTJava2CAstTranslator.java

License:Open Source License

private CAstNode visit(ThisExpression n, WalkContext context) {
    if (n.getQualifier() != null) {
        ITypeBinding owningType = n.getQualifier().resolveTypeBinding();
        TypeReference owningTypeRef = fIdentityMapper.getTypeRef(owningType);
        return makeNode(context, fFactory, n, CAstNode.THIS, fFactory.makeConstant(owningTypeRef));
    } else//from  w  w  w.  j a  v  a2s  . c o m
        return makeNode(context, fFactory, n, CAstNode.THIS);
}

From source file:com.windowtester.eclipse.ui.convert.WTAPIAbstractVisitor.java

License:Open Source License

/**
 * Cache the expression information//ww w.j  a va2 s .c  o m
 */
public void endVisit(ThisExpression node) {
    String typeName = null;
    Name qualifier = node.getQualifier();
    if (qualifier != null)
        typeName = context.resolve(qualifier.getFullyQualifiedName());
    currentScope.setNodeType(node, typeName);
    currentScope.setNodeValue(node, node);
}

From source file:de.ovgu.cide.export.physical.ahead.MethodObjectHelper.java

License:Open Source License

private static void changeThisAccessToField(Block oldMethodBody) {
    final AST ast = oldMethodBody.getAST();
    oldMethodBody.accept(new ASTVisitor() {
        @Override//from   www  . j av  a  2s .c  o m
        public void endVisit(ThisExpression node) {
            assert node.getQualifier() == null;
            Expression _thisExpr = ast.newSimpleName("_this");
            RefactoringUtils.replaceASTNode(node, _thisExpr);
            super.endVisit(node);
        }
    });
}

From source file:edu.cmu.cs.crystal.tac.eclipse.EclipseTAC.java

License:Open Source License

/**
 * Returns the {@link ThisVariable} for the given <code>this</code>
 * expression./*from ww w .j av a 2  s  . co m*/
 * @param node
 * @return the {@link ThisVariable} for the given <code>this</code>
 * expression.
 */
private ThisVariable getThisVariable(ThisExpression node) {
    Name qualifier = node.getQualifier();
    /**
     * The rule is that the declared, generic type, is the single canonical type.
     * Parameterized types are actually different type bindings.
     * @see org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment#createParameterizedType(ReferenceBinding genericType, TypeBinding[] typeArguments, ReferenceBinding enclosingType)
     */
    ITypeBinding generic_type = node.resolveTypeBinding().getTypeDeclaration();
    ThisVariable result = thisVar.get(generic_type);
    if (result == null) {
        // explicitly qualified this
        result = new ThisVariable(this, qualifier);
        thisVar.put(node.resolveTypeBinding(), result);
    }
    if (result.isImplicit()) {
        // fix up qualifier of previously created implicitly qualified this variable
        result.explicitQualifier(node.getQualifier());
    }
    return result;
}

From source file:java5totext.input.JDTVisitor.java

License:Open Source License

@Override
public void endVisit(org.eclipse.jdt.core.dom.ThisExpression node) {
    ThisExpression element = (ThisExpression) this.binding.get(node);
    this.initializeNode(element, node);

    if (this.binding.get(node.getQualifier()) != null)
        element.setQualifier((NamedElementRef) this.binding.get(node.getQualifier()));
}