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

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

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom SwitchCase 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

public SwitchCase convert(org.eclipse.jdt.internal.compiler.ast.CaseStatement statement) {
    SwitchCase switchCase = new SwitchCase(this.ast);
    org.eclipse.jdt.internal.compiler.ast.Expression constantExpression = statement.constantExpression;
    if (constantExpression == null) {
        switchCase.setExpression(null);//w w w. ja v  a2s.co  m
    } else {
        switchCase.setExpression(convert(constantExpression));
    }
    switchCase.setSourceRange(statement.sourceStart, statement.sourceEnd - statement.sourceStart + 1);
    retrieveColonPosition(switchCase);
    return switchCase;
}