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

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

Introduction

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

Prototype

VariableDeclarationStatement(AST ast) 

Source Link

Document

Creates a new unparented local variable declaration statement node owned by the given AST.

Usage

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

License:Open Source License

protected VariableDeclarationStatement convertToVariableDeclarationStatement(
        org.eclipse.jdt.internal.compiler.ast.LocalDeclaration localDeclaration) {
    final VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(
            localDeclaration);/*from www  .ja v a  2s .  co  m*/
    final VariableDeclarationStatement variableDeclarationStatement = new VariableDeclarationStatement(
            this.ast);
    variableDeclarationStatement.fragments().add(variableDeclarationFragment);
    if (this.resolveBindings) {
        recordNodes(variableDeclarationFragment, localDeclaration);
    }
    variableDeclarationStatement.setSourceRange(localDeclaration.declarationSourceStart,
            localDeclaration.declarationSourceEnd - localDeclaration.declarationSourceStart + 1);
    Type type = convertType(localDeclaration.type);
    setTypeForVariableDeclarationStatement(variableDeclarationStatement, type,
            variableDeclarationFragment.getExtraDimensions());
    if (localDeclaration.modifiersSourceStart != -1) {
        setModifiers(variableDeclarationStatement, localDeclaration);
    }
    return variableDeclarationStatement;
}