public void setText(final String text, final boolean format) {
        content.setWidget(editor.asWidget());
        if (text == null) {
            editor.setText("");
        } else {
            if (format) {
                final String formattedText = formatAsIfXml(text);
                editor.setText(formattedText);
                applyFormattedHighlights(formattedText);
            } else {
                editor.setText(text);
            }
        }
    }
This is a widget that can be used to edit text. It provides useful
functionality such as formatting, styling, line numbers and warning/error
markers.
stroom-core-client-widget/src/main/java/stroom/editor/client/view/EditorViewImpl.java