|
Re: Persisting a complete model into one file [message #1017740 is a reply to message #1017691] |
Tue, 12 March 2013 13:14 |
|
Hi,
You could iterate your model with eAllContents() and, for every EObject
that has an eDirectResource(), remove it from the eDirectResource()'s
getContents() list.
Just be careful not to remove the root element(s) of your model from
their resource, otherwise you'll end up with an empty file. :-)
HTH,
Christian
On 2013-03-12 10:37:59 +0000, Vince Cadmus said:
> Hi all,
>
> I'm a bit new to EMF, so may be the question can seem a basic one, but
> I haven't found an esay answer yet :(
>
> I have an eCore model with containment/proxies reference (let's say
> object A has a list containing multiple B references). Each B object is
> stored in its own XMI file, and object A has just a proxy reference to
> it. That works fine :)
>
> than the use case is that I would like to use multiple files in a sort
> of "development mode", but when everything is well defined and won't
> change very often, it's easier for me to have everything in one file.
>
> So I would like to be able to store A with all B objects in one XMI
> file (so without any proxy reference to other files).
> How can I do that, how can I go from a multi-resources model to a
> one-resource one ?
>
> Thanks ! :)
|
|
|
Re: Persisting a complete model into one file [message #1017760 is a reply to message #1017691] |
Tue, 12 March 2013 13:42 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Vince,
Comments below.
On 12/03/2013 11:37 AM, Vince Cadmus wrote:
> Hi all,
>
> I'm a bit new to EMF, so may be the question can seem a basic one, but
> I haven't found an esay answer yet :(
>
> I have an eCore model with containment/proxies reference (let's say
> object A has a list containing multiple B references). Each B object
> is stored in its own XMI file, and object A has just a proxy reference
> to it. That works fine :)
>
> than the use case is that I would like to use multiple files in a sort
> of "development mode", but when everything is well defined and won't
> change very often, it's easier for me to have everything in one file.
>
> So I would like to be able to store A with all B objects in one XMI
> file (so without any proxy reference to other files).
> How can I do that, how can I go from a multi-resources model to a
> one-resource one ?
Simply remove each B from its resource's getContents(). E.g., you could
write something like this
for (B b : a.getBs())
{
b.eResource().getContents().remove(b);
}
>
> Thanks ! :)
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.02608 seconds