Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Deleting one way reference
Deleting one way reference [message #900953] Thu, 09 August 2012 08:13 Go to next message
Martin  odloucký is currently offline Martin odlouckýFriend
Messages: 49
Registered: July 2010
Member
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 #900958 is a reply to message #900953] Thu, 09 August 2012 08:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Martin,

Comments below.

On 09/08/2012 10:13 AM, Martin odloucký wrote:
> 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.
DeleteCommand should find all references to the object from any other
objects contained by resources in the resource set. Is your problem
that you have references from resources that aren't loaded in the
resource set?
> Thanks for any help
>
> Martin


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Deleting one way reference [message #900967 is a reply to message #900958] Thu, 09 August 2012 08:57 Go to previous messageGo to next message
Martin  odloucký is currently offline Martin odlouckýFriend
Messages: 49
Registered: July 2010
Member
Oh, I did not know that DeleteCommand can do such a magical thing. I actually confused it with RemoveCommand in my question. Thanks a lot Ed.
Re: Deleting one way reference [message #901166 is a reply to message #900967] Fri, 10 August 2012 08:00 Go to previous messageGo to next message
Martin  odloucký is currently offline Martin odlouckýFriend
Messages: 49
Registered: July 2010
Member
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?
Re: Deleting one way reference [message #901176 is a reply to message #901166] Fri, 10 August 2012 08:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[CDO] conflict merging
Next Topic:[CDO] Nested generic types can't be committed
Goto Forum:
  


Current Time: Thu Mar 28 23:29:33 GMT 2024

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

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

Back to the top