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

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

Introduction

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

Prototype

DefaultCommentMapper(Comment[] table) 

Source Link

Usage

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

License:Open Source License

public void convert(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc, BodyDeclaration bodyDeclaration) {
    if (bodyDeclaration.getJavadoc() == null) {
        if (javadoc != null) {
            if (this.commentMapper == null || !this.commentMapper.hasSameTable(this.commentsTable)) {
                this.commentMapper = new DefaultCommentMapper(this.commentsTable);
            }/*  w  w  w.j  a  va2 s. c o  m*/
            Comment comment = this.commentMapper.getComment(javadoc.sourceStart);
            if (comment != null && comment.isDocComment() && comment.getParent() == null) {
                Javadoc docComment = (Javadoc) comment;
                if (this.resolveBindings) {
                    recordNodes(docComment, javadoc);
                    // resolve member and method references binding
                    Iterator tags = docComment.tags().listIterator();
                    while (tags.hasNext()) {
                        recordNodes(javadoc, (TagElement) tags.next());
                    }
                }
                bodyDeclaration.setJavadoc(docComment);
            }
        }
    }
}

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

License:Open Source License

public void convert(org.eclipse.jdt.internal.compiler.ast.Javadoc javadoc,
        PackageDeclaration packageDeclaration) {
    switch (this.ast.apiLevel) {
    case AST.JLS2_INTERNAL:
        return;/*from  w  ww . j a v a  2s.  c  om*/
    }
    if (packageDeclaration.getJavadoc() == null) {
        if (javadoc != null) {
            if (this.commentMapper == null || !this.commentMapper.hasSameTable(this.commentsTable)) {
                this.commentMapper = new DefaultCommentMapper(this.commentsTable);
            }
            Comment comment = this.commentMapper.getComment(javadoc.sourceStart);
            if (comment != null && comment.isDocComment() && comment.getParent() == null) {
                Javadoc docComment = (Javadoc) comment;
                if (this.resolveBindings) {
                    recordNodes(docComment, javadoc);
                    // resolve member and method references binding
                    Iterator tags = docComment.tags().listIterator();
                    while (tags.hasNext()) {
                        recordNodes(javadoc, (TagElement) tags.next());
                    }
                }
                packageDeclaration.setJavadoc(docComment);
            }
        }
    }
}