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

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

Introduction

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

Prototype

StringLiteral(AST ast) 

Source Link

Document

Creates a new unparented string literal node owned by the given AST.

Usage

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

License:Open Source License

public StringLiteral convert(org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral expression) {
    expression.computeConstant();// ww  w.j a  v  a 2s.  c om
    StringLiteral literal = new StringLiteral(this.ast);
    if (this.resolveBindings) {
        this.recordNodes(literal, expression);
    }
    literal.setLiteralValue(expression.constant.stringValue());
    literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
    return literal;
}

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

License:Open Source License

public Expression convert(org.eclipse.jdt.internal.compiler.ast.StringLiteral expression) {
    if (expression instanceof StringLiteralConcatenation) {
        return convert((StringLiteralConcatenation) expression);
    }// w  w  w.  j av a  2  s  .com
    int length = expression.sourceEnd - expression.sourceStart + 1;
    int sourceStart = expression.sourceStart;
    StringLiteral literal = new StringLiteral(this.ast);
    if (this.resolveBindings) {
        this.recordNodes(literal, expression);
    }
    literal.internalSetEscapedValue(new String(this.compilationUnitSource, sourceStart, length));
    literal.setSourceRange(expression.sourceStart, expression.sourceEnd - expression.sourceStart + 1);
    return literal;
}