Document doc = new Document(str);
formatter.formatAll(doc, null, false, formatStd, false);
str = doc.get();
} catch (SyntaxErrorException e) {
}
FastStringBuffer buf = new FastStringBuffer();
for (String line : StringUtils.splitInLines(str)) {
buf.append(line);
char c = buf.lastChar();
if (c == '\n') {
buf.deleteLast();
if (showSpacesAndNewLines) {
buf.append("\\n");
}
//Adds chars so that the initial presentation is bigger (they are later changed for spaces).
//If that's not done, the created editor would be too small... especially if we consider
//that the code-formatting can change for that editor (so, some parts wouldn't appear if we
//need more space later on).
buf.appendN('|', 8);
buf.append(c);
}
}
String result = buf.toString();
String finalResult;
if (showSpacesAndNewLines) {
finalResult = result.replace(' ', '.');
} else {