maybe the uri is wrong? If the resource is not null you can
retrieve its contents via getContents().
You may have a look at the TutorialUtil for inspiration.
Also, you may want to ponder on reusing the resource set of the diagram editor...
For pure EMF questions, please use the EMF forum.
thanks for the quick reply!
Good to know my code is basically correct.
I will check the URI again.
( update: URI is correct. resource.getcontents() is not null, but empty. I will use the EMF Forum for details )
Sorry, I don't understand what you mean by "reusing the resource set of the diagram editor". Could you explain this?
the diagram editor has a resource set where the resource
for the graphiti model is managed.
You might use this resource set instead of creating a new one.
You might have a look at the method saveToModelFile
in the TutorialUtil.
I finally solved the problem.
If anybody has the same problem, here is my solution:
// LOAD OTX MODEL FROM FILE
ResourceSet resourceSet = new ResourceSetImpl();
URI fileURI = URI.createFileURI(new File("filepath.xml").getAbsolutePath() );
Resource poResource = resourceSet.getResource(fileURI, true);
// Add business objects to list
Set<EObject> eObjects = new HashSet<EObject>();