if (representation == null
|| !OODrawRepresentation.TYPE.equals(representation.getType()))
return null;
OODrawRepresentation ooRepresentation = (OODrawRepresentation) representation;
IShapeProvider shapeProvider = ooRepresentation.getShapeProvider();
IOfficeApplication officeApplication = EditorCorePlugin.getDefault()
.getManagedLocalOfficeApplication();
IDrawingDocument document;
try {
document = (IDrawingDocument) officeApplication
.getDocumentService().constructNewDocument(IDocument.DRAW,
DocumentDescriptor.DEFAULT_HIDDEN);
} catch (NOAException e) {
return null;
} catch (OfficeApplicationException e) {
return null;
}
IShapeFactory shapeFactory = document.getDrawPage(0).getShapeFactory();
IShape shape = shapeProvider.provide(shapeFactory);
File image;
try {
image = export(shape, document);
} catch (Exception e) {