ITextRange textRange = position.getTextRange();
ITextContentService textContentService = textDocument.getTextService()
.getTextContentService();
ITextDocumentImage textDocumentImage = null;
try {
textDocumentImage = textContentService
.constructNewImage(graphicInfo);
textContentService.insertTextContent(textRange, textDocumentImage);
} catch (TextException e) {
textDocumentImage = null;
// TODO Auto-generated catch block
e.printStackTrace();
}
if (textDocumentImage == null)
return null;
String id = generateID();
setXName(textDocumentImage.getXTextContent(), generateID());
return id;
}