Generate the implementation for the documentation formatter.
17484
@SuppressWarnings("checkstyle:all")
	protected void generateDocumentationFormatterImpl() {
		final TypeReference formatter = getDocumentationFormatterImpl();
		StringConcatenationClient content = new StringConcatenationClient() {
			@SuppressWarnings("synthetic-access")
			@Override
			protected void appendTo(TargetStringConcatenation it) {
				it.append("/** Formatter a documentation string."); //$NON-NLS-1$
				it.newLine();
				it.append(" */"); //$NON-NLS-1$
				it.newLine();
				it.append("public class DocumentationFormatter implements "); //$NON-NLS-1$
				it.append(getIDocumentationFormatter());
				it.append(" {"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate static final String SPACE_CHAR = \" \";"); //$NON-NLS-1$
				it.newLine();
				it.append("\tprivate static final String NL_CHAR = \"\\n\";"); //$NON-NLS-1$
				it.newLine();
				it.append("\tprivate static final String EMPTY_STR = \"\";"); //$NON-NLS-1$
				it.newLine();
				it.append("\tprivate String mlLinePrefix;"); //$NON-NLS-1$
				it.newLine();
				it.append("\tprivate String mlStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\tprivate String mlEnd;"); //$NON-NLS-1$
				it.newLine();
				it.append("\tprivate String slPrefix;"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprotected static boolean isNewLine(char character) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (character == '\\n' || character == '\\r' || character == '\\f') {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\treturn ((((1 << Character.LINE_SEPARATOR)"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t| (1 << Character.PARAGRAPH_SEPARATOR)) >> Character.getType((int) character)) & 1) != 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String getMultilineCommentStartSymbols() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn this.mlStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic void setMultilineCommentStartSymbols(String symbols) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tthis.mlStart = symbols;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String getMultilineCommentEndSymbols() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn this.mlEnd;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic void setMultilineCommentEndSymbols(String symbols) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tthis.mlEnd = symbols;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String getMultilineCommentLinePrefix() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn this.mlLinePrefix;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic void setMultilineCommentLinePrefix(String prefix) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tthis.mlLinePrefix = prefix;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String getSinglelineCommentPrefix() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn this.slPrefix;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tprotected "); //$NON-NLS-1$
				it.append(Set.class);
				it.append("<Character> getSinglelineCommentSpecialChars() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal "); //$NON-NLS-1$
				it.append(Set.class);
				it.append("<Character> set = new "); //$NON-NLS-1$
				it.append(TreeSet.class);
				it.append("<>();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tset.add('*');"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tset.add('+');"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tset.add('-');"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tset.add('=');"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn set;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic void setSinglelineCommentPrefix(String prefix) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tthis.slPrefix = prefix;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Inject.class);
				it.newLine();
				it.append("\tpublic void setGrammarAccess("); //$NON-NLS-1$
				it.append(DocumentationBuilderFragment.this.grammarAccessExtensions.getGrammarAccess(getGrammar()));
				it.append(" access) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (this.mlStart == null || this.mlEnd == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t"); //$NON-NLS-1$
				it.append(AbstractRule.class);
				it.append(" mlRule = access.getML_COMMENTRule();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfor ("); //$NON-NLS-1$
				it.append(AbstractElement.class);
				it.append(" element : (("); //$NON-NLS-1$
				it.append(Group.class);
				it.append(") mlRule.getAlternatives()).getElements()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (element instanceof "); //$NON-NLS-1$
				it.append(Keyword.class);
				it.append(" && this.mlStart == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tthis.mlStart = (("); //$NON-NLS-1$
				it.append(Keyword.class);
				it.append(") element).getValue();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t} else if (element instanceof "); //$NON-NLS-1$
				it.append(UntilToken.class);
				it.append(" && this.mlEnd == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tthis.mlEnd = (("); //$NON-NLS-1$
				it.append(Keyword.class);
				it.append(") (("); //$NON-NLS-1$
				it.append(UntilToken.class);
				it.append(") element).getTerminal()).getValue();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (this.mlLinePrefix == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.mlLinePrefix = this.mlStart.substring(this.mlStart.length() - 1);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (this.slPrefix == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t"); //$NON-NLS-1$
				it.append(AbstractRule.class);
				it.append(" slRule = access.getSL_COMMENTRule();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfor ("); //$NON-NLS-1$
				it.append(AbstractElement.class);
				it.append(" element : (("); //$NON-NLS-1$
				it.append(Group.class);
				it.append(") slRule.getAlternatives()).getElements()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (element instanceof "); //$NON-NLS-1$
				it.append(Keyword.class);
				it.append(") {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tthis.slPrefix = (("); //$NON-NLS-1$
				it.append(Keyword.class);
				it.append(") element).getValue().trim();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tbreak;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String formatMultilineComment(String doc) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn formatMultilineComment(doc, (String) null);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String formatMultilineComment(String doc, String indentation) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t"); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable = new "); //$NON-NLS-1$
				it.append(StringBuilderBasedAppendable.class);
				it.append("();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatMultilineComment(doc, indentation, appendable);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn appendable.getContent();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic void formatMultilineComment(String doc, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatMultilineComment(doc, null, appendable);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic void formatMultilineComment(String doc, String indentation, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (!"); //$NON-NLS-1$
				it.append(Strings.class);
				it.append(".isEmpty(doc)) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> replacements = new "); //$NON-NLS-1$
				it.append(TreeMap.class);
				it.append("();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tformatMultlineComment(indentation, Strings.newLine(), new AppendableAccessor(appendable, doc, replacements, 0, doc.length()));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic void formatMultilineComment("); //$NON-NLS-1$
				it.append(ITextReplacerContext.class);
				it.append(" context, "); //$NON-NLS-1$
				it.append(IComment.class);
				it.append(" comment) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatMultlineComment(context.getIndentationString(), context.getNewLinesString(1), new RegionAccessor(context, comment));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic String formatSinglelineComment(String doc) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn formatSinglelineComment(doc, (String) null);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\t\tpublic String formatSinglelineComment(String doc, String indentation) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t"); //$NON-NLS-1$
				it.append(StringBuilderBasedAppendable.class);
				it.append(" appendable = new "); //$NON-NLS-1$
				it.append(StringBuilderBasedAppendable.class);
				it.append("();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatSinglelineComment(doc, indentation, appendable);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn appendable.getContent();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic void formatSinglelineComment(String doc, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatSinglelineComment(doc, null, appendable);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t@"); //$NON-NLS-1$
				it.append(Pure.class);
				it.newLine();
				it.append("\tpublic void formatSinglelineComment(String doc, String indentation, "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (!"); //$NON-NLS-1$
				it.append(Strings.class);
				it.append(".isEmpty(doc)) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> replacements = new "); //$NON-NLS-1$
				it.append(TreeMap.class);
				it.append("<>();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint offset = doc.indexOf(getSinglelineCommentPrefix());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (offset < 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\toffset = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint endOffset = doc.indexOf(NL_CHAR, offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (endOffset < 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tendOffset = doc.length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tformatSinglelineComment("); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tindentation,"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tnew AppendableAccessor(appendable, doc, replacements, offset, endOffset));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic void formatSinglelineComment("); //$NON-NLS-1$
				it.append(ITextReplacerContext.class);
				it.append(" context, "); //$NON-NLS-1$
				it.append(IComment.class);
				it.append(" comment) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatSinglelineComment(context.getIndentationString(), new RegionAccessor(context, comment));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate <T> void formatSinglelineComment(String indentationString, FormattedTextAccessor<T> backend) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal String indent = "); //$NON-NLS-1$
				it.append(Strings.class);
				it.append(".emptyIfNull(indentationString);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal String comment = backend.getCommentText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Compute the starting offset of the text inside the comment"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint offset = comment.indexOf(getSinglelineCommentPrefix());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (offset < 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tbackend.replace(0, 0, getSinglelineCommentPrefix());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\toffset = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\toffset += getSinglelineCommentPrefix().length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal int endOffset = comment.length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tT currentLine = backend.getFirstLine(backend.getCommentOffset());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tboolean firstLine = true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\twhile (currentLine != null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tString lineText = backend.getLineText(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint lineOffset = backend.getLineOffset(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint lineLength = backend.getLineLength(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Clamp the line text to the comment area."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (firstLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (lineOffset < offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tfinal int len = offset - lineOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineText = lineText.substring(len);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineOffset += len;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineLength -= len;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t} else if (lineOffset >= endOffset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// After the end of comment"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tbackend.applyReplacements();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\treturn;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tfinal String prefix;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (!startsWith(lineText, 0, getSinglelineCommentPrefix())) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tprefix = indent + getSinglelineCommentPrefix();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tprefix = indent;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tbackend.replace(lineOffset, 0, prefix);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Skip the comment characters that corresponds to the Javadoc format: //[*-+=]."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint realCommentStart = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal "); //$NON-NLS-1$
				it.append(Set.class);
				it.append("<Character> specialChars = getSinglelineCommentSpecialChars();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile (realCommentStart < lineLength && specialChars.contains(lineText.charAt(realCommentStart))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t++realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Search for the first non whitespace"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint firstNonWhiteSpacePos = realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile (firstNonWhiteSpacePos < lineLength && Character.isWhitespace(lineText.charAt(firstNonWhiteSpacePos))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t++firstNonWhiteSpacePos;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Add whitespace at the beginning."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (firstNonWhiteSpacePos == lineLength) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// Empty comment"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (realCommentStart < firstNonWhiteSpacePos) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tbackend.replace(realCommentStart + lineOffset, lineLength - realCommentStart, EMPTY_STR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tfinal int expectedNbWhiteSpaces = getWhiteSpacesOnFirstLine();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tfinal int nbWhiteSpaces = firstNonWhiteSpacePos - realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (nbWhiteSpaces != expectedNbWhiteSpaces) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tbackend.replace(realCommentStart + lineOffset, nbWhiteSpaces, makeWhiteSpaces(expectedNbWhiteSpaces));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// Format the comment text"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tformatLineText("); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineText.substring(firstNonWhiteSpacePos, lineLength), true,"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tnew SubAccessor<>(backend, lineOffset + firstNonWhiteSpacePos));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// Remove trailing whitespaces"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tint endOfText = lineLength;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\twhile ((endOfText - 1) > firstNonWhiteSpacePos && Character.isWhitespace(lineText.charAt(endOfText - 1))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\t--endOfText;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (endOfText < lineLength) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tbackend.replace(endOfText + lineOffset, lineLength - endOfText, EMPTY_STR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfirstLine = false;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tcurrentLine = backend.getNextLine(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tbackend.applyReplacements();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate static String safeSubstring(String text, int start, int length) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (text == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn EMPTY_STR;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal int index = Math.max(0, start);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal int len = Math.max(0, Math.min(length, text.length()));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn text.substring(index, index + len);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate static boolean startsWith(String text, int start, String pattern) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn safeSubstring(text, start, pattern.length()).equals(pattern);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate static String makeWhiteSpaces(int nb) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal StringBuilder b = new StringBuilder();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfor (int i = 0; i < nb; ++i) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tb.append(SPACE_CHAR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn b.toString();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprotected int getWhiteSpacesOnFirstLine() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn 1;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprotected int getWhiteSpacesOnOtherLines() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn 1;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprotected <T> void formatLineText(String lineText, boolean isMultlineComment, FormattedTextAccessor<T> backend) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate <T> boolean formatMultlineCommentFirstLine(String lineText, String indentationString, String newLineString, int endCommentOffset, FormattedTextAccessor<T> backend) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Skip the comment characters that corresponds to the Javadoc format: /**."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint realCommentStart = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\twhile (realCommentStart < lineText.length() && startsWith(lineText, realCommentStart, getMultilineCommentLinePrefix())) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\trealCommentStart += getMultilineCommentLinePrefix().length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Search for the first non whitespace"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint firstNonWhiteSpacePos = realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tboolean hasNonSpaceChar = false;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\twhile (firstNonWhiteSpacePos < lineText.length() && Character.isWhitespace(lineText.charAt(firstNonWhiteSpacePos))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (!Character.isSpaceChar(lineText.charAt(firstNonWhiteSpacePos))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\thasNonSpaceChar = true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t++firstNonWhiteSpacePos;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Add whitespace at the beginning."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal int expectedNbWhiteSpaces = getWhiteSpacesOnFirstLine();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal int nbWhiteSpaces = firstNonWhiteSpacePos - realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (hasNonSpaceChar || nbWhiteSpaces != expectedNbWhiteSpaces) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tbackend.replace(realCommentStart, nbWhiteSpaces, makeWhiteSpaces(expectedNbWhiteSpaces));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Treat the end of comment"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (endCommentOffset <= lineText.length()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Comment end at the first line. Insert a newline character"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Search for the end of comment text."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint endPos = endCommentOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal int end = endPos;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile ((endPos - 1) > firstNonWhiteSpacePos && Character.isWhitespace(lineText.charAt(endPos - 1))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t--endPos;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Format the comment text"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tformatLineText(lineText.substring(firstNonWhiteSpacePos, endPos), true, new SubAccessor<>(backend, firstNonWhiteSpacePos));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Do the replacement"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tbackend.replace(endPos, end - endPos, newLineString + indentationString + SPACE_CHAR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// We don't need to treat more line"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Format the comment text"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tformatLineText(lineText.substring(firstNonWhiteSpacePos, lineText.length()), true, new SubAccessor<>(backend, firstNonWhiteSpacePos));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn false;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate <T> boolean formatMultlineCommentOtherLines(String lineText, String indentationString, String newLineString, int endCommentOffset, FormattedTextAccessor<T> backend) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Search for the comment prefix (usually \" * \""); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint realCommentStart = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\twhile (realCommentStart < lineText.length() && Character.isWhitespace(lineText.charAt(realCommentStart))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t++realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tboolean foundStar = false;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (realCommentStart < lineText.length() && startsWith(lineText, realCommentStart, getMultilineCommentLinePrefix())) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\trealCommentStart += getMultilineCommentLinePrefix().length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfoundStar = true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile (realCommentStart < lineText.length() && Character.isWhitespace(lineText.charAt(realCommentStart))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t++realCommentStart;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Compute the standard prefix."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tStringBuilder prefix = new StringBuilder(indentationString);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprefix.append(SPACE_CHAR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprefix.append(getMultilineCommentLinePrefix());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprefix.append(makeWhiteSpaces(getWhiteSpacesOnOtherLines()));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Force replacement by the line's prefix"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint minBoundForEnd = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (endCommentOffset > lineText.length() || foundStar || realCommentStart < endCommentOffset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tbackend.replace(0, realCommentStart, prefix.toString());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (foundStar) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tminBoundForEnd = prefix.length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Format the comment text"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (endCommentOffset <= lineText.length()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// End of comment on the current line."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint endPosition = endCommentOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal int end = endPosition;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile ((endPosition - 1) >= minBoundForEnd && Character.isWhitespace(lineText.charAt(endPosition - 1))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t--endPosition;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (endPosition > 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// Comment end with a text before. Insert a newline character"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tbackend.replace(endPosition, end - endPosition, newLineString + indentationString + SPACE_CHAR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// Replace spaces before end of comment if they exist"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tbackend.replace(endPosition, end - endPosition, indentationString + SPACE_CHAR);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// We don't need to treat more line"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\treturn false;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate <T> void formatMultlineComment(String indentationString, String newLineString, FormattedTextAccessor<T> backend) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal String indent = Strings.emptyIfNull(indentationString);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tfinal String comment = backend.getCommentText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t// Compute the starting offset of the text inside the comment"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint offset = comment.indexOf(getMultilineCommentStartSymbols());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tif (offset < 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tbackend.replace(0, 0, getMultilineCommentStartSymbols());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\toffset = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\toffset += getMultilineCommentStartSymbols().length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Compute the ending offset of the text inside the comment"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint endOffset = comment.indexOf(getMultilineCommentEndSymbols(), offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (endOffset < 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tendOffset = comment.length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tbackend.replace(endOffset, 0, getMultilineCommentEndSymbols());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t// Go through the lines"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tT currentLine = backend.getFirstLine(backend.getCommentOffset());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tboolean firstLine = true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile (currentLine != null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tString lineText = backend.getLineText(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tint lineOffset = backend.getLineOffset(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tint lineLength = backend.getLineLength(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t// Clamp the line text to the comment area."); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (lineOffset < offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tfinal int len = offset - lineOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineText = lineText.substring(len);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineOffset += len;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineLength -= len;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif ((lineOffset + lineLength) > endOffset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tfinal int len = lineOffset + lineLength - endOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineText = lineText.substring(0, lineText.length() - len);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tlineLength -= len;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (firstLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tif (formatMultlineCommentFirstLine(lineText, indent, newLineString, endOffset - lineOffset, new SubAccessor(backend, lineOffset))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\t\tbackend.applyReplacements();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\t\treturn;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (formatMultlineCommentOtherLines(lineText, indent, newLineString, endOffset - lineOffset, new SubAccessor(backend, lineOffset))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tbackend.applyReplacements();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\treturn;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfirstLine = false;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tcurrentLine = backend.getNextLine(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tbackend.applyReplacements();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLine();
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic interface FormattedTextAccessor<T> {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tT getFirstLine(int offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tT getNextLine(T currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint getLineOffset(T currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint getLineLength(T currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tString getLineText(T line);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tString getCommentText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint getCommentOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tint getCommentEndOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tReplacement replace(int offset, int length, String newText);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tvoid applyReplacements();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic class SubAccessor<T> implements FormattedTextAccessor<T> {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final FormattedTextAccessor<T> parent;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int offsetInParent;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic SubAccessor(FormattedTextAccessor<T> parent, int offsetInParent) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tassert parent != null;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.parent = parent;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.offsetInParent = offsetInParent;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic T getFirstLine(int offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getFirstLine(offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic T getNextLine(T currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getNextLine(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getLineOffset(T currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getLineOffset(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getLineLength(T currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getLineLength(currentLine);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String getLineText(T line) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getLineText(line);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String getCommentText() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getCommentText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getCommentOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getCommentOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getCommentEndOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.getCommentEndOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic Replacement replace(int offset, int length, String newText) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.parent.replace(this.offsetInParent + offset, length, newText);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic final void applyReplacements() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthrow new UnsupportedOperationException();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic static class Line {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int length;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic static Line newInstance(String text, int offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (offset < 0 || offset >= text.length()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\treturn null;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint soffset = offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile (soffset >= 0 && !isNewLine(text.charAt(soffset))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t--soffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t++soffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint eoffset = soffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\twhile (eoffset < text.length() && !isNewLine(text.charAt(eoffset))) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t++eoffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal int length = "); //$NON-NLS-1$
				it.append(Math.class);
				it.append(".max(0, eoffset - soffset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn new Line(soffset, length);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate Line(int offset, int length) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.offset = offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.length = length;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getLength() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.length;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String toString() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn \"offset: \" + getOffset() + \"; length: \" + getLength();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic static abstract class AbstractReplacementAccessor<T> implements FormattedTextAccessor<T> {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final String documentation;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> replacements;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate boolean applied;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic AbstractReplacementAccessor(String documentation, "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> replacements) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.documentation = documentation;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.replacements = replacements;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprotected final void checkNotApplied() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (this.applied) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tthrow new IllegalStateException(\"Changes are already applied\");"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.applied = true;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String getCommentText() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.documentation;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprotected "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> getReplacements() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (this.replacements == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tthis.replacements = new "); //$NON-NLS-1$
				it.append(TreeMap.class);
				it.append("<>();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.replacements;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic Replacement replace(int offset, int length, String newText) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tReplacement rep = getReplacements().remove(offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (rep == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\trep = new Replacement(offset, length, newText);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\trep = new Replacement(offset, rep.getLength() + length, rep.getText() + newText);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tgetReplacements().put(offset, rep);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn rep;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprotected static void applyReplacements("); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable, String text, "); //$NON-NLS-1$
				it.append(Map.class);
				it.append("<Integer, Replacement> replacements) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint offset = 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfor (final Replacement replacement : replacements.values()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tif (replacement.getOffset() < offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tappendable.append(\"<<<Conflicting replacements>>>\");"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t} else {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tassert offset >= 0;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tassert replacement.getOffset() <= text.length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tString notReplacedString = text.substring(offset, replacement.getOffset());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tappendable.append(notReplacedString);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\toffset += notReplacedString.length();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\tappendable.append(replacement.getText());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t\toffset += replacement.getLength();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (offset < text.length()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tString notReplacedString = text.substring(offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tappendable.append(notReplacedString);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic static abstract class AbstractDebuggingAccessor<T> extends AbstractReplacementAccessor<T> {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate String buffer;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic AbstractDebuggingAccessor(String text, "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> replacements) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tsuper(text, replacements);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate String computeBuffer() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t"); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" appendable = new "); //$NON-NLS-1$
				it.append(FakeTreeAppendable.class);
				it.append("();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tapplyReplacements(appendable, getCommentText(), getReplacements());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn appendable.getContent();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String toString() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (this.buffer == null) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tthis.buffer = computeBuffer();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.buffer;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic Replacement replace(int offset, int length, String newText) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal Replacement rep = super.replace(offset, length, newText);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.buffer = computeBuffer();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn rep;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic static class RegionAccessor extends AbstractReplacementAccessor<"); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append("> {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final "); //$NON-NLS-1$
				it.append(ITextReplacerContext.class);
				it.append(" context;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final "); //$NON-NLS-1$
				it.append(ITextRegionAccess.class);
				it.append(" access;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final "); //$NON-NLS-1$
				it.append(IComment.class);
				it.append(" comment;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic RegionAccessor("); //$NON-NLS-1$
				it.append(ITextReplacerContext.class);
				it.append(" context, "); //$NON-NLS-1$
				it.append(IComment.class);
				it.append(" comment) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tsuper(comment.getText(), null);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.context = context;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.comment = comment;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.access = comment.getTextRegionAccess();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic String getCommentText() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.comment.getText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic String getLineText("); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append(" line) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t"); //$NON-NLS-1$
				it.append(ITextSegment.class);
				it.append(" segment = this.access.regionForOffset(line.getOffset(), line.getLength());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn segment.getText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getCommentOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.comment.getOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getCommentEndOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.comment.getEndOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic "); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append(" getFirstLine(int offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.access.regionForLineAtOffset(offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic "); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append(" getNextLine("); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append(" currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn currentLine.getNextLine();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getLineOffset("); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append(" currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn currentLine.getOffset() - getCommentOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getLineLength("); //$NON-NLS-1$
				it.append(ILineRegion.class);
				it.append(" currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn currentLine.getLength();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic void applyReplacements() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tcheckNotApplied();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfor (Replacement replacement : getReplacements().values()) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\t"); //$NON-NLS-1$
				it.append(ITextSegment.class);
				it.append(" target = this.access.regionForOffset(replacement.getOffset() + getCommentOffset(), replacement.getLength());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\tthis.context.addReplacement(target.replaceWith(replacement.getText()));"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tprivate static class AppendableAccessor extends AbstractReplacementAccessor<Line> {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final "); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" target;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int commentOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int commentEndOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic AppendableAccessor("); //$NON-NLS-1$
				it.append(IAppendable.class);
				it.append(" target, String documentation, "); //$NON-NLS-1$
				it.append(SortedMap.class);
				it.append("<Integer, Replacement> replacements, int commentOffset, int commentEndOffset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tsuper(documentation, replacements);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.target = target;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.commentOffset = commentOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.commentEndOffset = commentEndOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic Line getFirstLine(int offset) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn Line.newInstance(getCommentText(), offset);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic Line getNextLine(Line currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tint index = getCommentText().indexOf(NL_CHAR, currentLine.getOffset());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tif (index < 0) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t\treturn null;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn Line.newInstance(getCommentText(), index + 1);"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getLineOffset(Line currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn currentLine.getOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getLineLength(Line currentLine) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn currentLine.getLength();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic String getLineText(Line line) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tfinal int offset = line.getOffset();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn getCommentText().substring(offset, offset + line.getLength());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getCommentOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.commentOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic int getCommentEndOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.commentEndOffset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t\tpublic void applyReplacements() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tcheckNotApplied();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tapplyReplacements(this.target, getCommentText(), getReplacements());"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\tpublic static class Replacement {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final int length;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tprivate final String text;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic Replacement(int offset, int length, String text) {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.offset = offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.length = length;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\tthis.text = text;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getOffset() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.offset;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic int getLength() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.length;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String getText() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn this.text;"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\tpublic String toString() {"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t\treturn \"offset: \" + getOffset() + \"; length: \" + getLength() + \"; new text: \" + getText();"); //$NON-NLS-1$
				it.newLine();
				it.append("\t\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("\t}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
				it.append("}"); //$NON-NLS-1$
				it.newLineIfNotEmpty();
				it.newLine();
			}

		};
		JavaFileAccess createJavaFile = getFileAccessFactory().createJavaFile(formatter, content);
		createJavaFile.writeTo(getSrcGen());
	}
16872
def _build_document_converter(cls, session: AppSession):
        ''''''

        if not session.args.convert_links:
            return

        converter = session.factory.new(
            'BatchDocumentConverter',
            session.factory['HTMLParser'],
            session.factory['ElementWalker'],
            session.factory['URLTable'],
            backup=session.args.backup_converted
        )

        return converter
597094
public static void generate(ConfigurationImpl configuration) {
        DocPath filename = DocPaths.DEPRECATED_LIST;
        try {
            DeprecatedListWriter depr =
                   new DeprecatedListWriter(configuration, filename);
            depr.generateDeprecatedListFile(
                   new DeprecatedAPIListBuilder(configuration));
            depr.close();
        } catch (IOException exc) {
            configuration.standardmessage.error(
                        "doclet.exception_encountered",
                        exc.toString(), filename);
            throw new DocletAbortException(exc);
        }
    }
572006
def autobuild_docproject():
    """"""

    try:
        #Build only release information
        family = utilities.get_family('module_settings.json')
        autobuild_release(family)
        autobuild_documentation(family.tile)
    except unit_test.IOTileException as e:
        print(e.format())
        Exit(1)
36132
public function docGenerate()
    {
        $this->_exec('cd '.__DIR__.'/docs && composer install');
        $this->_exec(__DIR__.'/docs/build');
        $this->_exec(__DIR__.'/vendor/bin/couscous preview');
    }
1208033
def generate_doxygen_xml(app):
    """"""
    read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
    if read_the_docs_build:
        run_doxygen('..')
        sys.stderr.write('Check if shared lib exists\n')
        run_build_lib('..')
    sys.stderr.write('The wrapper path: %s\n' % str(os.listdir('../wrapper')))
    rabit._loadlib()
394100
private function generate()
	{
		// only load sections if we dont have a cache
		$this->discoverComponentSections();

		// generate output by processing sections
		$this->output['sections'] = $this->processComponentSections($this->sections);

		// remove duplicate available versions & order
		$this->output['versions']['available'] = array_unique($this->output['versions']['available']);

		// get the highest version available
		$this->output['versions']['max'] = end($this->output['versions']['available']);

		// create cache folder
		$cacheFile = PATH_APP . DS . 'cache' . DS . 'api' . DS . 'documentation.json';

		if (App::has('filesystem') && !App::get('filesystem')->exists(dirname($cacheFile)))
		{
			App::get('filesystem')->makeDirectory(dirname($cacheFile));
		}

		// save cache file
		file_put_contents($cacheFile, json_encode($this->output));
	}
763586
private function buildDocumentation() {
        $model = new Swagger\Model();
        $model->setId($this->getClassName());
        $this->buildProperties($model);
        foreach($this->getRelatedModels() as $alias => $relatedModel) {
            $this->buildProperties($model, $alias);
        }
        $resource = new Swagger\Resource();
        $resource->setApiVersion('1.0')->setBasePath('/v1.0')->setResourcePath($this->getClassName());
        $resource->setDescription('');
        $documentation = $model . "\n" . $resource;
        $this->getObject()->setDocumentation($documentation);
    }
441714
public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
        DocPath filename = DocPaths.overviewSummary(configuration.frames);
        PackageIndexWriter packgen = new PackageIndexWriter(configuration, filename);
        packgen.buildPackageIndexFile("doclet.Window_Overview_Summary", true);
    }
1106581
def generate_apiary_doc(task_router):
    
    generator = ApiaryDoc()

    for m in task_router.get_task_packages() + get_method_packages():
        m = importlib.import_module(m)
        generator.docmodule(m)

    return generator
165740
function buildDocs() {
  return Promise.resolve()
    .then(() => new Promise((resolve, reject) => {
      Metalsmith(__dirname)
        .source('./source/docs')
        .destination('./docs')
        .clean(true)
        .use(Markdown())
        .metadata({
          version: __version
        })
        .use(Layouts({
          engine: 'handlebars',
          directory: './source/layouts',
          rename: false
        }))
        // Update {{version}} in content since it's not processed with Handlebars
        .use((files, metalsmith, done) => {
          Object.keys(files).forEach((key) => {
            let file = files[key];

            file.contents = new Buffer(
              file.contents
                .toString()
                .replace(/\{\{version\}\}/g, __version)
            );
          });

          done();
        })
        .build((err) => {
          if(err) {
            reject(err);
            return;
          }
          console.log(Chalk.green('Docs generated! 📚'));

          resolve();
        });
    }));
}
554258
public static void generate(ConfigurationImpl configuration, ClassUseMapper mapper,
                                TypeElement typeElement) throws DocFileIOException {
        ClassUseWriter clsgen;
        DocPath path = DocPath.forPackage(configuration.utils, typeElement)
                              .resolve(DocPaths.CLASS_USE)
                              .resolve(DocPath.forName(configuration.utils, typeElement));
        clsgen = new ClassUseWriter(configuration, mapper, path, typeElement);
        clsgen.generateClassUseFile();
    }
239965
def _generate_event_doc(event):
    '''
    
    '''

    # Create a copy of the object that we will return.
    eventc = event.copy()

    # Set the ID of the document to be the JID.
    eventc["_id"] = '{}-{}'.format(
                                    event.get('tag', '').split('/')[2],
                                    event.get('tag', '').split('/')[3]
                                  )

    # Add a timestamp field to the document
    eventc["timestamp"] = time.time()

    # remove any return data as it's captured in the "returner" function
    if eventc.get('data').get('return'):
        del eventc['data']['return']

    return eventc
339926
public static void generate(ConfigurationImpl configuration) throws DocFileIOException {
        DocPath filename = DocPaths.MODULE_OVERVIEW_FRAME;
        ModuleIndexFrameWriter modulegen = new ModuleIndexFrameWriter(configuration, filename);
        modulegen.buildModuleIndexFile("doclet.Window_Overview", false);
    }
325405
def generate(env):
    """"""

    env.SetDefault(
        # Default names for customized XSL stylesheets
        DOCBOOK_DEFAULT_XSL_EPUB = '',
        DOCBOOK_DEFAULT_XSL_HTML = '',
        DOCBOOK_DEFAULT_XSL_HTMLCHUNKED = '',
        DOCBOOK_DEFAULT_XSL_HTMLHELP = '',
        DOCBOOK_DEFAULT_XSL_PDF = '',
        DOCBOOK_DEFAULT_XSL_MAN = '',
        DOCBOOK_DEFAULT_XSL_SLIDESPDF = '',
        DOCBOOK_DEFAULT_XSL_SLIDESHTML = '',
        
        # Paths to the detected executables
        DOCBOOK_XSLTPROC = '',
        DOCBOOK_XMLLINT = '',
        DOCBOOK_FOP = '',
        
        # Additional flags for the text processors
        DOCBOOK_XSLTPROCFLAGS = SCons.Util.CLVar(''),
        DOCBOOK_XMLLINTFLAGS = SCons.Util.CLVar(''),
        DOCBOOK_FOPFLAGS = SCons.Util.CLVar(''),
        DOCBOOK_XSLTPROCPARAMS = SCons.Util.CLVar(''),
        
        # Default command lines for the detected executables
        DOCBOOK_XSLTPROCCOM = xsltproc_com['xsltproc'],
        DOCBOOK_XMLLINTCOM = xmllint_com['xmllint'],
        DOCBOOK_FOPCOM = fop_com['fop'],

        # Screen output for the text processors
        DOCBOOK_XSLTPROCCOMSTR = None,
        DOCBOOK_XMLLINTCOMSTR = None,
        DOCBOOK_FOPCOMSTR = None,
        
        )
    _detect(env)

    env.AddMethod(DocbookEpub, "DocbookEpub")
    env.AddMethod(DocbookHtml, "DocbookHtml")
    env.AddMethod(DocbookHtmlChunked, "DocbookHtmlChunked")
    env.AddMethod(DocbookHtmlhelp, "DocbookHtmlhelp")
    env.AddMethod(DocbookPdf, "DocbookPdf")
    env.AddMethod(DocbookMan, "DocbookMan")
    env.AddMethod(DocbookSlidesPdf, "DocbookSlidesPdf")
    env.AddMethod(DocbookSlidesHtml, "DocbookSlidesHtml")
    env.AddMethod(DocbookXInclude, "DocbookXInclude")
    env.AddMethod(DocbookXslt, "DocbookXslt")
1341705
def generate_docs(app):
    
    config = app.config
    config_dir = app.env.srcdir
    source_root = os.path.join(config_dir, config.apidoc_source_root)
    output_root = os.path.join(config_dir, config.apidoc_output_root)
    execution_dir = os.path.join(config_dir, '..')

    # Remove any files generated by earlier builds
    cleanup(output_root)

    command = ['sphinx-apidoc', '-f', '-o', output_root, source_root]
    # Exclude anything else we were specifically asked to
    for exclude in config.apidoc_exclude:
        command.append(os.path.join(source_root, exclude))
    process = Popen(command, cwd=execution_dir)
    process.wait()
51370
def _generate_doc(ret):
    '''
    
    '''

    # Create a copy of the object that we will return.
    retc = ret.copy()

    # Set the ID of the document to be the JID.
    retc["_id"] = ret["jid"]

    # Add a timestamp field to the document
    retc["timestamp"] = time.time()

    return retc