public UndoableEdit insertString(int where, String str, boolean beforeMarkers) throws BadLocationException { CharBuffer b = buffer; if (where < 0 || where > b.length()) throw new BadLocationException("bad insert", where); b.insert(where, str, beforeMarkers); GapUndoableEdit undo = new GapUndoableEdit(where); undo.content = this; undo.data = str; undo.nitems = str.length(); undo.isInsertion = true; return undo; }