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

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

Introduction

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

Prototype

BlockComment(AST ast) 

Source Link

Document

Creates a new block comment node owned by the given AST.

Usage

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

License:Open Source License

protected Comment createComment(int[] positions) {
    // Create comment node
    Comment comment = null;//from   ww  w .  java  2  s  .c  o m
    int start = positions[0];
    int end = positions[1];
    if (positions[1] > 0) { // Javadoc comments have positive end position
        Javadoc docComment = this.docParser.parse(positions);
        if (docComment == null)
            return null;
        comment = docComment;
    } else {
        end = -end;
        if (positions[0] == 0) { // we cannot know without testing chars again
            if (this.docParser.scanner.source[1] == '/') {
                comment = new LineComment(this.ast);
            } else {
                comment = new BlockComment(this.ast);
            }
        } else if (positions[0] > 0) { // Block comment have positive start position
            comment = new BlockComment(this.ast);
        } else { // Line comment have negative start and end position
            start = -start;
            comment = new LineComment(this.ast);
        }
        comment.setSourceRange(start, end - start);
    }
    return comment;
}