void (TextRange rangeWithinElement, String replacementText) { final RangeMarker key = myDocument.createRangeMarker(rangeWithinElement.shiftRight(myContainerElement.getStartOffset())); ConstantNode value = new ConstantNode(replacementText); replaceElement(key, value); }