protected void copyIndentation(final IDocument d, final DocumentCommand c) { // CODE KOPIERT AUS SUPER-KLASSE DA DORT PRIVATE // == DefaultIndentLineAutoEditStrategy.autoIndentAfterNewLine(IDocument d, DocumentCommand c) if (c.offset == -1 || d.getLength() == 0) return; try { // find start of line int p = (c.offset == d.getLength() ? c.offset - 1 : c.offset); IRegion info = d.getLineInformationOfOffset(p); int start = info.getOffset(); // find white spaces int end = findEndOfWhiteSpace(d, start, c.offset); StringBuffer buf = new StringBuffer(c.text); if (end > start) { // append to input buf.append(d.get(start, end - start)); } c.text = buf.toString(); } catch (BadLocationException excp) { // stop work } }