Example usage for org.eclipse.jdt.core.dom FieldDeclaration setSourceRange

List of usage examples for org.eclipse.jdt.core.dom FieldDeclaration setSourceRange

Introduction

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

Prototype

public final void setSourceRange(int startPosition, int length) 

Source Link

Document

Sets the source range of the original source file where the source fragment corresponding to this node was found.

Usage

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

License:Open Source License

protected FieldDeclaration convertToFieldDeclaration(
        org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDecl) {
    VariableDeclarationFragment variableDeclarationFragment = convertToVariableDeclarationFragment(fieldDecl);
    final FieldDeclaration fieldDeclaration = new FieldDeclaration(this.ast);
    fieldDeclaration.fragments().add(variableDeclarationFragment);
    if (this.resolveBindings) {
        recordNodes(variableDeclarationFragment, fieldDecl);
        variableDeclarationFragment.resolveBinding();
    }/*from  w  w  w .j a  v a2  s.  c om*/
    fieldDeclaration.setSourceRange(fieldDecl.declarationSourceStart,
            fieldDecl.declarationEnd - fieldDecl.declarationSourceStart + 1);
    Type type = convertType(fieldDecl.type);
    setTypeForField(fieldDeclaration, type, variableDeclarationFragment.getExtraDimensions());
    setModifiers(fieldDeclaration, fieldDecl);
    convert(fieldDecl.javadoc, fieldDeclaration);
    return fieldDeclaration;
}