Lines 1897-1905
Link Here
|
1897 |
CommentFormatterUtil.log(e); |
1897 |
CommentFormatterUtil.log(e); |
1898 |
return; |
1898 |
return; |
1899 |
} |
1899 |
} |
1900 |
int prefixOffset= inputBuffer.indexOf(contentPrefix, lineOffset); |
1900 |
int prefixOffset = inputBuffer.indexOf(contentPrefix, lineOffset); |
1901 |
if (prefixOffset >= 0 && inputBuffer.substring(lineOffset, prefixOffset).trim().length() == 0) |
1901 |
if (prefixOffset >= 0 && inputBuffer.substring(lineOffset, prefixOffset).trim().length() == 0) { |
1902 |
inputBuffer.delete(lineOffset, prefixOffset + 1 + 1); |
1902 |
if (inputBuffer.charAt(prefixOffset + 1) == ' ' || inputBuffer.charAt(prefixOffset + 1) == '\t') |
|
|
1903 |
inputBuffer.delete(lineOffset, prefixOffset + 1 + 1); |
1904 |
else |
1905 |
inputBuffer.delete(lineOffset, prefixOffset + 1); |
1906 |
} |
1903 |
} |
1907 |
} |
1904 |
|
1908 |
|
1905 |
// 2 - convert HTML to Java (@see JavaDocRegion#convertHtml2Java) |
1909 |
// 2 - convert HTML to Java (@see JavaDocRegion#convertHtml2Java) |
Lines 3330-3352
Link Here
|
3330 |
if (isCode) { |
3334 |
if (isCode) { |
3331 |
int codeEnd = (int) (text.separators[max] >>> 32); |
3335 |
int codeEnd = (int) (text.separators[max] >>> 32); |
3332 |
if (codeEnd > end) { |
3336 |
if (codeEnd > end) { |
3333 |
if (this.formatter.preferences.comment_format_source) { |
3337 |
if (this.formatter.preferences.comment_format_source) { |
3334 |
if (textStart < end) addReplaceEdit(textStart, end, buffer.toString()); |
3338 |
if (textStart < end) addReplaceEdit(textStart, end, buffer.toString()); |
3335 |
// Count the lines until the exact start position of the code |
3339 |
// Count the lines until the exact start position of the code |
3336 |
this.scanner.resetTo(end+1, nextStart-1); |
3340 |
this.scanner.resetTo(end+1, nextStart-1); |
3337 |
int newLines = 0; |
3341 |
int newLines = 0; |
|
|
3342 |
int realEnd = nextStart; |
3343 |
boolean spaceFound = true; |
3338 |
try { |
3344 |
try { |
3339 |
int token = this.scanner.getNextToken(); |
3345 |
int token = this.scanner.getNextToken(); |
3340 |
loop: while (true) { |
3346 |
loop: while (true) { |
3341 |
switch (token) { |
3347 |
switch (token) { |
3342 |
case TerminalTokens.TokenNameWHITESPACE: |
3348 |
case TerminalTokens.TokenNameWHITESPACE: |
3343 |
if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) < 0) { |
3349 |
if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) < 0) { |
|
|
3350 |
if (realEnd != nextStart) |
3351 |
realEnd++; |
3352 |
spaceFound = true; |
3344 |
break loop; |
3353 |
break loop; |
3345 |
} |
3354 |
} |
3346 |
newLines++; |
3355 |
newLines++; |
3347 |
break; |
3356 |
break; |
3348 |
case TerminalTokens.TokenNameMULTIPLY: |
3357 |
case TerminalTokens.TokenNameMULTIPLY: |
3349 |
nextStart = this.scanner.currentPosition + 1; |
3358 |
realEnd = this.scanner.currentPosition; |
|
|
3359 |
spaceFound = false; |
3350 |
break; |
3360 |
break; |
3351 |
default: |
3361 |
default: |
3352 |
break loop; |
3362 |
break loop; |
Lines 3358-3364
Link Here
|
3358 |
// skip |
3368 |
// skip |
3359 |
} |
3369 |
} |
3360 |
if (newLines == 0) newLines=1; |
3370 |
if (newLines == 0) newLines=1; |
3361 |
printJavadocGapLines(end+1, nextStart-1, newLines, false/* clear first blank lines inside <pre> tag as done by old formatter */, false, null); |
3371 |
printJavadocGapLines(end+1, realEnd-1, newLines, false/* clear first blank lines inside <pre> tag as done by old formatter */, false, null); |
|
|
3372 |
if (realEnd < nextStart) |
3373 |
nextStart = realEnd; |
3374 |
if (spaceFound == false) |
3375 |
addInsertEdit(realEnd, " "); //$NON-NLS-1$ |
3362 |
printCodeSnippet(nextStart, codeEnd); |
3376 |
printCodeSnippet(nextStart, codeEnd); |
3363 |
nextStart = (int) text.separators[max]; |
3377 |
nextStart = (int) text.separators[max]; |
3364 |
printJavadocGapLines(codeEnd+1, nextStart-1, 1, false/* clear blank lines inside <pre> tag as done by old formatter */, false, null); |
3378 |
printJavadocGapLines(codeEnd+1, nextStart-1, 1, false/* clear blank lines inside <pre> tag as done by old formatter */, false, null); |