int offset = 0; // TODO in forms use "\" + varName + "\"
MultiTextEdit multiEdit = new MultiTextEdit();
int len = variableName.length();
while (offset > -1) {
offset = document.search(offset, variableName, true, true, true);
if (offset == -1) {
break;
}
ReplaceEdit replaceEdit = new ReplaceEdit(offset, len, replacement);
multiEdit.addChild(replaceEdit);