private void printJavadocNewLine(StringBuffer buffer) { buffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(buffer); buffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; this.line++; this.lastNumberOfNewLines++; }
private void printJavadocNewLine(StringBuffer buffer) { buffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(buffer); buffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; this.line++; this.lastNumberOfNewLines++; }
private void printJavadocNewLine(StringBuffer buffer) { buffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(buffer); buffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; this.line++; this.lastNumberOfNewLines++; }
private void printBlockCommentHeaderLine(StringBuffer buffer) { if (!this.formatter.preferences.comment_new_lines_at_block_boundaries) { buffer.insert(0, ' '); this.column++; } else if (buffer.length() == 0) { buffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(buffer); buffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; } else { this.tempBuffer.setLength(0); this.tempBuffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; buffer.insert(0, this.tempBuffer.toString()); } }
private void printBlockCommentHeaderLine(StringBuffer buffer) { if (!this.formatter.preferences.comment_new_lines_at_block_boundaries) { buffer.insert(0, ' '); this.column++; } else if (buffer.length() == 0) { buffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(buffer); buffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; } else { this.tempBuffer.setLength(0); this.tempBuffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; buffer.insert(0, this.tempBuffer.toString()); } }
private void printBlockCommentHeaderLine(StringBuffer buffer) { if (!this.formatter.preferences.comment_new_lines_at_block_boundaries) { buffer.insert(0, ' '); this.column++; } else if (buffer.length() == 0) { buffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(buffer); buffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; } else { this.tempBuffer.setLength(0); this.tempBuffer.append(this.lineSeparator); this.column = 1; printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH; buffer.insert(0, this.tempBuffer.toString()); } }
void printIndentationIfNecessary() { this.tempBuffer.setLength(0); printIndentationIfNecessary(this.tempBuffer); if (this.tempBuffer.length() > 0) { addInsertEdit(this.scanner.getCurrentTokenStartPosition(), this.tempBuffer.toString()); this.pendingSpace = false; } }
void printIndentationIfNecessary() { this.tempBuffer.setLength(0); printIndentationIfNecessary(this.tempBuffer); if (this.tempBuffer.length() > 0) { addInsertEdit(this.scanner.getCurrentTokenStartPosition(), this.tempBuffer.toString()); this.pendingSpace = false; } }
void printIndentationIfNecessary() { this.tempBuffer.setLength(0); printIndentationIfNecessary(this.tempBuffer); if (this.tempBuffer.length() > 0) { addInsertEdit(this.scanner.getCurrentTokenStartPosition(), this.tempBuffer.toString()); this.pendingSpace = false; } }
this.tempBuffer.setLength(0); for (int i = 0; i < linesNumber; i++) { printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(this.lineSeparator); this.column = 1; this.tempBuffer.setLength(0); for (int i = 0; i < linesNumber; i++) { printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(this.lineSeparator); this.column = 1; this.tempBuffer.setLength(0); for (int i = 0; i < realNewLineNumber; i++) { printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(this.lineSeparator); this.column = 1;
private void print(int length, boolean considerSpaceIfAny) { if (this.checkLineWrapping && length + this.column > this.pageWidth) { handleLineTooLong(); } this.lastNumberOfNewLines = 0; if (this.indentationLevel != 0) { printIndentationIfNecessary(); } if (considerSpaceIfAny) { space(); } if (this.pendingSpace) { addInsertEdit(this.scanner.getCurrentTokenStartPosition(), " "); //$NON-NLS-1$ } this.pendingSpace = false; this.column += length; this.needSpace = true; }
private void print(int length, boolean considerSpaceIfAny) { if (this.checkLineWrapping && length + this.column > this.pageWidth) { handleLineTooLong(); } this.lastNumberOfNewLines = 0; if (this.indentationLevel != 0) { printIndentationIfNecessary(); } if (considerSpaceIfAny) { space(); } if (this.pendingSpace) { addInsertEdit(this.scanner.getCurrentTokenStartPosition(), " "); //$NON-NLS-1$ } this.pendingSpace = false; this.column += length; this.needSpace = true; }
private void print(int length, boolean considerSpaceIfAny) { if (this.checkLineWrapping && length + this.column > this.pageWidth) { handleLineTooLong(); } this.lastNumberOfNewLines = 0; if (this.indentationLevel != 0) { printIndentationIfNecessary(); } if (considerSpaceIfAny) { space(); } if (this.pendingSpace) { addInsertEdit(this.scanner.getCurrentTokenStartPosition(), " "); //$NON-NLS-1$ } this.pendingSpace = false; this.needSpace = false; this.column += length; this.needSpace = true; }
private String getPreserveEmptyLines(int count, int emptyLinesRules) { if (count == 0) { int currentIndentationLevel = this.indentationLevel; int useAlignmentBreakIndentation = useAlignmentBreakIndentation(emptyLinesRules); switch (useAlignmentBreakIndentation) { case PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION: return Util.EMPTY_STRING; default: // Return the new indented line StringBuffer buffer = new StringBuffer(getNewLine()); printIndentationIfNecessary(buffer); if (useAlignmentBreakIndentation == PRESERVE_EMPTY_LINES_USE_TEMPORARY_INDENTATION) { this.indentationLevel = currentIndentationLevel; } return buffer.toString(); } } if (this.blank_lines_between_import_groups >= 0) { useAlignmentBreakIndentation(emptyLinesRules); return getEmptyLines(this.blank_lines_between_import_groups); } if (this.formatter.preferences.number_of_empty_lines_to_preserve != 0) { useAlignmentBreakIndentation(emptyLinesRules); int linesToPreserve = Math.min(count, this.formatter.preferences.number_of_empty_lines_to_preserve); return getEmptyLines(linesToPreserve); } return getNewLine(); } private int useAlignmentBreakIndentation(int emptyLinesRules) {
private String getPreserveEmptyLines(int count, int emptyLinesRules) { if (count == 0) { int currentIndentationLevel = this.indentationLevel; int useAlignmentBreakIndentation = useAlignmentBreakIndentation(emptyLinesRules); switch (useAlignmentBreakIndentation) { case PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION: return Util.EMPTY_STRING; default: // Return the new indented line StringBuffer buffer = new StringBuffer(getNewLine()); printIndentationIfNecessary(buffer); if (useAlignmentBreakIndentation == PRESERVE_EMPTY_LINES_USE_TEMPORARY_INDENTATION) { this.indentationLevel = currentIndentationLevel; } return buffer.toString(); } } if (this.blank_lines_between_import_groups >= 0) { useAlignmentBreakIndentation(emptyLinesRules); return getEmptyLines(this.blank_lines_between_import_groups); } if (this.formatter.preferences.number_of_empty_lines_to_preserve != 0) { useAlignmentBreakIndentation(emptyLinesRules); int linesToPreserve = Math.min(count, this.formatter.preferences.number_of_empty_lines_to_preserve); return getEmptyLines(linesToPreserve); } return getNewLine(); } private int useAlignmentBreakIndentation(int emptyLinesRules) {
private String getPreserveEmptyLines(int count, int emptyLinesRules) { if (count == 0) { int currentIndentationLevel = this.indentationLevel; int useAlignmentBreakIndentation = useAlignmentBreakIndentation(emptyLinesRules); switch (useAlignmentBreakIndentation) { case PRESERVE_EMPTY_LINES_DO_NOT_USE_ANY_INDENTATION: return Util.EMPTY_STRING; default: // Return the new indented line StringBuffer buffer = new StringBuffer(getNewLine()); printIndentationIfNecessary(buffer); if (useAlignmentBreakIndentation == PRESERVE_EMPTY_LINES_USE_TEMPORARY_INDENTATION) { this.indentationLevel = currentIndentationLevel; } return buffer.toString(); } } if (this.blank_lines_between_import_groups >= 0) { useAlignmentBreakIndentation(emptyLinesRules); return getEmptyLines(this.blank_lines_between_import_groups); } if (this.formatter.preferences.number_of_empty_lines_to_preserve != 0) { useAlignmentBreakIndentation(emptyLinesRules); int linesToPreserve = Math.min(count, this.formatter.preferences.number_of_empty_lines_to_preserve); return getEmptyLines(linesToPreserve); } return getNewLine(); } private int useAlignmentBreakIndentation(int emptyLinesRules) {
this.tempBuffer.setLength(0); this.column = 1; printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH;
this.tempBuffer.setLength(0); this.column = 1; printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH;
this.tempBuffer.setLength(0); this.column = 1; printIndentationIfNecessary(this.tempBuffer); this.tempBuffer.append(BLOCK_LINE_PREFIX); this.column += BLOCK_LINE_PREFIX_LENGTH;
printIndentationIfNecessary(); int currentLine = this.line; int firstBlockStart = previousBlock.sourceStart; printIndentationIfNecessary(null); this.column += JAVADOC_HEADER_LENGTH; // consider that the header is already scanned