Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Add to resource and eResource still null ?
Add to resource and eResource still null ? [message #418922] Fri, 02 May 2008 13:27 Go to next message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Hello all,

Wanting to add an object to a rsource and the code below (straight from EMF
book) was tried
When I called eResource after adding object to resource it comes back null

Anyone got any idea what I'm doing wrong ?


thanks.

MyObject myObj = ObjectFactory.eINSTANCE.createMyObject();


URI fileURI =
URI.createFileURI(new File("mypo.xml").getAbsolutePath());
Resource poResource = resourceSet.createResource(fileURI);
poResource.getContents().add(myObj);
try {
poResource.save(null);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Resource rf = MyObj.eResource();
Re: Add to resource and eResource still null ? [message #418923 is a reply to message #418922] Fri, 02 May 2008 13:34 Go to previous message
Alan is currently offline AlanFriend
Messages: 44
Registered: July 2009
Member
Forget it - I was doing something stupid.
In my defence it is Friday :-)


"Alan" <awm_abu@yahoo.com> wrote in message
news:fvf4rq$emc$1@build.eclipse.org...
> Hello all,
>
> Wanting to add an object to a rsource and the code below (straight from
> EMF book) was tried
> When I called eResource after adding object to resource it comes back null
>
> Anyone got any idea what I'm doing wrong ?
>
>
> thanks.
>
> MyObject myObj = ObjectFactory.eINSTANCE.createMyObject();
>
>
> URI fileURI =
> URI.createFileURI(new File("mypo.xml").getAbsolutePath());
> Resource poResource = resourceSet.createResource(fileURI);
> poResource.getContents().add(myObj);
> try {
> poResource.save(null);
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> Resource rf = MyObj.eResource();
>
Previous Topic:Interoperation of different EMF versions?
Next Topic:Creating eCore from Java Annotations fails
Goto Forum:
  


Current Time: Wed Apr 24 15:55:44 GMT 2024

Powered by FUDForum. Page generated in 0.03139 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top