List of usage examples for org.eclipse.jdt.core.dom CompilationUnit setCommentTable
void setCommentTable(Comment[] commentTable)
From source file:org.eclipse.jdt.core.dom.ASTConverter.java
License:Open Source License
/** * @param compilationUnit//from w ww . j a v a 2 s .c o m * @param comments */ void buildCommentsTable(CompilationUnit compilationUnit, int[][] comments) { // Build comment table this.commentsTable = new Comment[comments.length]; int nbr = 0; for (int i = 0; i < comments.length; i++) { Comment comment = createComment(comments[i]); if (comment != null) { comment.setAlternateRoot(compilationUnit); this.commentsTable[nbr++] = comment; } } // Resize table if necessary if (nbr < comments.length) { Comment[] newCommentsTable = new Comment[nbr]; System.arraycopy(this.commentsTable, 0, newCommentsTable, 0, nbr); this.commentsTable = newCommentsTable; } compilationUnit.setCommentTable(this.commentsTable); }