Example usage for org.eclipse.jdt.core.dom ParenthesizedExpression ParenthesizedExpression

List of usage examples for org.eclipse.jdt.core.dom ParenthesizedExpression ParenthesizedExpression

Introduction

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

Prototype

ParenthesizedExpression(AST ast) 

Source Link

Document

Creates a new unparented parenthesized expression node owned by the given AST.

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public ParenthesizedExpression convertToParenthesizedExpression(
        org.eclipse.jdt.internal.compiler.ast.Expression expression) {
    final ParenthesizedExpression parenthesizedExpression = new ParenthesizedExpression(this.ast);
    if (this.resolveBindings) {
        recordNodes(parenthesizedExpression, expression);
    }//from   w w w .j  a v  a 2  s  . c  om
    parenthesizedExpression.setSourceRange(expression.sourceStart,
            expression.sourceEnd - expression.sourceStart + 1);
    adjustSourcePositionsForParent(expression);
    trimWhiteSpacesAndComments(expression);
    // decrement the number of parenthesis
    int numberOfParenthesis = (expression.bits
            & org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK) >> org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedSHIFT;
    expression.bits &= ~org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedMASK;
    expression.bits |= (numberOfParenthesis
            - 1) << org.eclipse.jdt.internal.compiler.ast.ASTNode.ParenthesizedSHIFT;
    parenthesizedExpression.setExpression(convert(expression));
    return parenthesizedExpression;
}