protected void createTag() { int lineStart = this.scanner.getLineNumber(this.tagSourceStart); if (this.inlineTagStarted) { FormatJavadocBlock block = new FormatJavadocBlock(this.inlineTagStart, this.tagSourceEnd, lineStart, this.tagValue); FormatJavadocBlock previousBlock = null; if (this.astPtr == -1) { previousBlock = new FormatJavadocBlock(this.inlineTagStart, this.tagSourceEnd, lineStart, NO_TAG_VALUE); pushOnAstStack(previousBlock, true); } else { previousBlock = (FormatJavadocBlock) this.astStack[this.astPtr]; } previousBlock.addBlock(block, this.htmlTagsPtr == -1 ? 0 : this.htmlTagsPtr); } else { FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue); pushOnAstStack(block, true); } }
void addBlock(FormatJavadocBlock block, int htmlLevel) { if (this.nodes != null) { FormatJavadocText[] textHierarchy = getTextHierarchy(block, htmlLevel); if (textHierarchy != null) { FormatJavadocText lastText = textHierarchy[htmlLevel]; if (lastText != null) { lastText.appendNode(block); for (int i=htmlLevel-1; i>=0; i--) { textHierarchy[i].sourceEnd = block.sourceEnd; } this.sourceEnd = block.sourceEnd; if (isParamTag()) { block.flags |= IN_PARAM_TAG; } else if (isDescription()) { block.flags |= IN_DESCRIPTION; } block.flags |= INLINED; return; } } } addNode(block); if (isParamTag()) { block.flags |= IN_PARAM_TAG; } else if (isDescription()) { block.flags |= IN_DESCRIPTION; } block.flags |= INLINED; }
protected void updateDocComment() { int length = this.astPtr + 1; FormatJavadoc formatJavadoc = new FormatJavadoc(this.javadocStart, this.javadocEnd, length); if (length > 0) { formatJavadoc.blocks = new FormatJavadocBlock[length]; for (int i=0; i<length; i++) { FormatJavadocBlock block = (FormatJavadocBlock) this.astStack[i]; block.clean(); block.update(this.scanner); formatJavadoc.blocks[i] = block; if (i== 0) { block.flags |= FormatJavadocBlock.FIRST; } } } formatJavadoc.textStart = this.javadocTextStart; formatJavadoc.textEnd = this.javadocTextEnd; formatJavadoc.lineStart = this.scanner.getLineNumber(this.javadocTextStart); formatJavadoc.lineEnd = this.scanner.getLineNumber(this.javadocTextEnd); FormatJavadocBlock firstBlock = formatJavadoc.getFirstBlock(); if (firstBlock != null) { firstBlock.setHeaderLine(formatJavadoc.lineStart); } this.docComment = formatJavadoc; if (DefaultCodeFormatter.DEBUG) { System.out.println(toDebugString()); } }
if (isDescription()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("description"); //$NON-NLS-1$ if (isFirst()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("first"); //$NON-NLS-1$ if (isHeaderLine()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("header line"); //$NON-NLS-1$ if (isImmutable()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("immutable"); //$NON-NLS-1$ if (isInDescription()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("in description"); //$NON-NLS-1$ if (isInlined()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("inlined"); //$NON-NLS-1$ if (isInParamTag()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("in param tag"); //$NON-NLS-1$ if (isOneLineTag()) {
boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0; int maxColumn = this.formatter.preferences.comment_line_length + 1; if (headerLine) { if (!block.isInlined()) { this.lastNumberOfNewLines = 0; if (block.isDescription()) { if (!block.isInlined()) { this.commentIndentation = null; int tagLength = previousEnd - block.sourceStart + 1; this.column += tagLength; if (!block.isInlined()) { boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isInDescription(); int commentIndentationLevel = 0; if (indentRootTags) { commentIndentationLevel = tagLength + 1; boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isInParamTag(); if (indentParamTag) { commentIndentationLevel += this.indentationSize; if (block.isInlined()) { this.column++; newLines = this.formatter.preferences.comment_insert_new_line_for_parameter && block.isParamTag() ? 1 : 0; if (nodeStart > (previousEnd+1)) { if (!clearBlankLines || !joinLines) {
void addText(FormatJavadocText text) { if (this.nodes != null) { FormatJavadocText[] textHierarchy = getTextHierarchy(text, text.depth); if (textHierarchy != null) { FormatJavadocText lastText = textHierarchy[text.depth]; addNode(text); if (isImmutable()) { text.immutable = true;
int lineStart = this.scanner.getLineNumber(start); if (this.astPtr == -1) { previousBlock = new FormatJavadocBlock(start, start, lineStart, NO_TAG_VALUE); pushOnAstStack(previousBlock, true); } else { previousBlock.addText(text); previousBlock.sourceStart = previousStart; if (lineStart == previousBlock.lineStart) {
private void printJavadocBlockReference(FormatJavadocBlock block, FormatJavadocReference reference) { int maxColumn = this.formatter.preferences.comment_line_length + 1; boolean headerLine = block.isHeaderLine(); boolean inlined = block.isInlined(); if (headerLine) maxColumn++;
int length = 0; boolean newLine = false; boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0; int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH; if (this.commentIndentation != null) firstColumn += this.commentIndentation.length(); FormatJavadocBlock inlinedBlock = (FormatJavadocBlock)node; if (isImmutableNode) { text = (FormatJavadocText) inlinedBlock.getLastNode(); if (text != null) { length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; // tag length
protected boolean pushThrowName(Object typeRef) { int lineStart = this.scanner.getLineNumber(this.tagSourceStart); FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue); block.reference = (FormatJavadocReference) typeRef; block.sourceEnd = block.reference.sourceEnd; pushOnAstStack(block, true); return true; }
if (length > 1) { if (previousBlock.isDescription()) { printJavadocBlock(previousBlock); FormatJavadocBlock block = javadoc.blocks[index++];
private void printJavadocTextLine(StringBuffer buffer, int textStart, int textEnd, FormatJavadocBlock block, boolean firstText, boolean needIndentation, boolean isHtmlTag) { boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0;
if (isDescription()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("description"); //$NON-NLS-1$ if (isFirst()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("first"); //$NON-NLS-1$ if (isHeaderLine()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("header line"); //$NON-NLS-1$ if (isImmutable()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("immutable"); //$NON-NLS-1$ if (isInDescription()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("in description"); //$NON-NLS-1$ if (isInlined()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("inlined"); //$NON-NLS-1$ if (isInParamTag()) { if (flagsBuffer.length() > 0) flagsBuffer.append(','); flagsBuffer.append("in param tag"); //$NON-NLS-1$ if (isOneLineTag()) {
boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0; int maxColumn = this.formatter.preferences.comment_line_length + 1; if (headerLine) { if (!block.isInlined()) { this.lastNumberOfNewLines = 0; if (block.isDescription()) { if (!block.isInlined()) { this.commentIndentation = null; int tagLength = previousEnd - block.sourceStart + 1; this.column += tagLength; if (!block.isInlined()) { boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isInDescription(); int commentIndentationLevel = 0; if (indentRootTags) { commentIndentationLevel = tagLength + 1; boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isInParamTag(); if (indentParamTag) { commentIndentationLevel += this.indentationSize; if (block.isInlined()) { this.column++; newLines = this.formatter.preferences.comment_insert_new_line_for_parameter && block.isParamTag() ? 1 : 0; if (nodeStart > (previousEnd+1)) { if (!clearBlankLines || !joinLines) {
void addText(FormatJavadocText text) { if (this.nodes != null) { FormatJavadocText[] textHierarchy = getTextHierarchy(text, text.depth); if (textHierarchy != null) { FormatJavadocText lastText = textHierarchy[text.depth]; addNode(text); if (isImmutable()) { text.immutable = true;
int lineStart = this.scanner.getLineNumber(start); if (this.astPtr == -1) { previousBlock = new FormatJavadocBlock(start, start, lineStart, NO_TAG_VALUE); pushOnAstStack(previousBlock, true); } else { previousBlock.addText(text); previousBlock.sourceStart = previousStart; if (lineStart == previousBlock.lineStart) {
private void printJavadocBlockReference(FormatJavadocBlock block, FormatJavadocReference reference) { int maxColumn = this.formatter.preferences.comment_line_length + 1; boolean headerLine = block.isHeaderLine(); boolean inlined = block.isInlined(); if (headerLine) maxColumn++;
int length = 0; boolean newLine = false; boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0; int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH; if (this.commentIndentation != null) firstColumn += this.commentIndentation.length(); FormatJavadocBlock inlinedBlock = (FormatJavadocBlock)node; if (isImmutableNode) { text = (FormatJavadocText) inlinedBlock.getLastNode(); if (text != null) { length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1; // tag length
protected boolean pushThrowName(Object typeRef) { int lineStart = this.scanner.getLineNumber(this.tagSourceStart); FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue); block.reference = (FormatJavadocReference) typeRef; block.sourceEnd = block.reference.sourceEnd; pushOnAstStack(block, true); return true; }
if (length > 1) { if (previousBlock.isDescription()) { printJavadocBlock(previousBlock); FormatJavadocBlock block = javadoc.blocks[index++];