Deleting one way reference [message #900953] |
Thu, 09 August 2012 04:13  |
Eclipse User |
|
|
|
Hi,
I have somwhat basic problem and would appriciate any help. I have a base EMF model and some classes in it. Let's say that instances of class A need to be referenced by objects from other EMF models contained in contributing plug-ins. The reference is therefore one way. How do I delete an instance of class A when I have no way of knowing (or at least it is very difficult) which objects are referencing the instance being deleted? If I delete the instance with classical DeleteCommand it stays referenced by the other objects which causes problems.
Thanks for any help
Martin
|
|
|
|
|
|
Re: Deleting one way reference [message #901176 is a reply to message #901166] |
Fri, 10 August 2012 04:20  |
Eclipse User |
|
|
|
Martin,
Comments below.
On 10/08/2012 10:00 AM, Martin odloucký wrote:
> Ok, the problem is not solved yet. I realised that not all objects
> referencing the deleted one are contained in a resource. They might
> be, but there is a problem. If I open a project in the tool I am
> developing, the project cannot be contained in a resource until the
> user chooses to save the project on disk. Otherwise I don't know which
> URI should I pass to createResource method because the newly created
> project is not associated with any file on disk yet. Is there some way
> around this?
ResourceSet.createResource only creates the in-memory resource in the
resource set. Not until you call save, will it be saved to disk, or
wherever the URI specifies it should go. You can also change the
resource's URI later (i.e., much like Save As does in the generated
editor). Of course the URI you specify in createResource determine
which already resource implementation is created, so you can either use
a dummy URI with the right extension or, if you're using content types,
specify the content type of the new resource.
|
|
|
Powered by
FUDForum. Page generated in 0.13731 seconds