protected void setDocumentContent(IDocument document, IEditorInput element)
throws CoreException {
IDiagramDocument diagramDocument = (IDiagramDocument) document;
TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
if (element instanceof URIEditorInput) {
URI uri = ((URIEditorInput) element).getURI();
Resource resource = null;
try {
resource = domain.getResourceSet().getResource(
uri.trimFragment(), false);
if (resource == null) {
resource = domain.getResourceSet().createResource(
uri.trimFragment());
}
if (!resource.isLoaded()) {
try {
Map options = new HashMap(GMFResourceFactory
.getDefaultLoadOptions());
// @see 171060
// options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
resource.load(options);
} catch (IOException e) {
resource.unload();
throw e;
}
}
if (uri.fragment() != null) {
EObject rootElement = resource.getEObject(uri.fragment());
if (rootElement instanceof Diagram) {
document.setContent((Diagram) rootElement);
return;
}
} else {