int nextIndex = currentIndex + 4;
while ((nextIndex < contents.length()) &&
(contents.charAt(nextIndex) == ' ')) {
nextIndex++;
}
CheckErrorResult errorResult = null;
if (possibleEndIndex > 0) {
errorResult = createCheckErrorResult(
analysis, currentIndex, possibleEndIndex + 2);
errorResult.addReplacement(
contents.substring(currentIndex, possibleEndIndex) + "-->",
GT._("Properly end the comment"));
} else if (previousStartIndex > 0) {
int tmpIndex = previousStartIndex;
while ((tmpIndex > 0) &&
((contents.charAt(tmpIndex - 1) == '\n') ||
(contents.charAt(tmpIndex - 1) == ' '))) {
tmpIndex--;
}
if (tmpIndex < currentIndex + 5) {
tmpIndex = currentIndex + 5;
}
int endIndex = previousStartIndex + 4;
errorResult = createCheckErrorResult(
analysis, currentIndex, endIndex);
errorResult.addReplacement(
contents.substring(currentIndex, tmpIndex) + "-->" + contents.substring(tmpIndex, endIndex),
GT._("Properly end the comment"));
errorResult.addReplacement(
contents.substring(currentIndex, previousStartIndex),
GT._("Merge comments"));
errorResult.addReplacement(
contents.substring(nextIndex, endIndex),
GT._("Uncomment"));
} else {
errorResult = createCheckErrorResult(
analysis, currentIndex, nextIndex);
errorResult.addReplacement("", GT._("Uncomment"));
}
errors.add(errorResult);
}
previousStartIndex = currentIndex;
}