Attr classAttribute = createClassAttribute(newBean, ownerDocument);
addNode(newBean, nextNode, BeansEditorUtils.getFile(document), beansNode);
try {
document.replace(getOffset(), 0, "");
ShallowFormatProcessorXML formatter = new ShallowFormatProcessorXML();
formatter.formatNode(newBean);
if (parentNode instanceof IDOMElement) {
int docLength = document.getLength();
int startOffset = ((IDOMElement) newBean).getStartOffset() - 1;
int length = ((IDOMElement) newBean).getLength() + 2;
formatter.formatDocument(document, startOffset >= 0 ? startOffset : 0,
length + startOffset <= docLength ? length : docLength - startOffset);
}
if (classAttribute instanceof AttrImpl && newBean instanceof IDOMNode) {
cursorPosition = ((IDOMNode) newBean).getStartOffset()