private MethodDeclaration resolveMethodDeclaration(ASTNode node) { if (node instanceof MethodDeclaration) return (MethodDeclaration)node; Javadoc doc= (Javadoc) ASTNodes.getParent(node, ASTNode.JAVADOC); if (doc == null) return null; if (doc.getParent() instanceof MethodDeclaration) return (MethodDeclaration) doc.getParent(); return null; }
@Override public boolean visit(Javadoc node) { if (!fScanTags) { return false; } ASTNode parent = node.getParent(); if (parent != null) { List<TagElement> tags = node.tags(); validateTags(parent, tags); } return false; }
public boolean visit(Javadoc node) { ASTNode parent = node.getParent(); if (parent == null) { parent = node.getAlternateRoot(); } insert(documentation, resolveBinding(parent), getSourceLocation(node)); return false; }
private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException { int startpos= comment.getStartPosition(); boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit; char[] content= (char[]) cu.getBuffer().getCharacters().clone(); if (isTopLevel && (wordStart + 6 < content.length)) { content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p'; content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't'; } if (wordStart < content.length) { for (int i= startpos; i < wordStart; i++) { content[i]= ' '; } } /* * Explicitly create a new non-shared working copy. */ ICompilationUnit newCU= cu.getWorkingCopy(null); newCU.getBuffer().setContents(content); return newCU; }
private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException { int startpos= comment.getStartPosition(); boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit; char[] content= cu.getBuffer().getCharacters().clone(); if (isTopLevel && (wordStart + 6 < content.length)) { content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p'; content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't'; } if (wordStart < content.length) { for (int i= startpos; i < wordStart; i++) { content[i]= ' '; } } /* * Explicitly create a new non-shared working copy. */ ICompilationUnit newCU= cu.getWorkingCopy(null); newCU.getBuffer().setContents(content); return newCU; }
private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException { int startpos= comment.getStartPosition(); boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit; char[] content= cu.getBuffer().getCharacters().clone(); if (isTopLevel && (wordStart + 6 < content.length)) { content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p'; content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't'; } if (wordStart < content.length) { for (int i= startpos; i < wordStart; i++) { content[i]= ' '; } } /* * Explicitly create a new non-shared working copy. */ ICompilationUnit newCU= cu.getWorkingCopy(null); newCU.getBuffer().setContents(content); return newCU; }
private static ICompilationUnit createPreparedCU(ICompilationUnit cu, Javadoc comment, int wordStart) throws JavaModelException { int startpos= comment.getStartPosition(); boolean isTopLevel= comment.getParent().getParent() instanceof CompilationUnit; char[] content= cu.getBuffer().getCharacters().clone(); if (isTopLevel && (wordStart + 6 < content.length)) { content[startpos++]= 'i'; content[startpos++]= 'm'; content[startpos++]= 'p'; content[startpos++]= 'o'; content[startpos++]= 'r'; content[startpos++]= 't'; } if (wordStart < content.length) { for (int i= startpos; i < wordStart; i++) { content[i]= ' '; } } /* * Explicitly create a new non-shared working copy. */ ICompilationUnit newCU= cu.getWorkingCopy(null); newCU.getBuffer().setContents(content); return newCU; }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); return true; }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); return true; }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); return true; }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); handleJavadocTagAlignment(node); return true; }