Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Flock] Delete and element and all of its children(Is it possible to delete all containment references at once?)
[Flock] Delete and element and all of its children [message #1101371] Wed, 04 September 2013 11:22 Go to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 155
Registered: October 2009
Senior Member

Hi,

I have a delete rule that deletes an Type. However, the result after execution is that all elements that where contained by elements of the deleted Type are left on the model (since they are now parent-less they reside at the root).

Is there any way to make a delete rule to delete all of the elements of containment relations too? Or at least a way of specifying a when statement in the lines of

when : owner.deleted() 


Regards,


Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: [Flock] Delete and element and all of its children [message #1101417 is a reply to message #1101371] Wed, 04 September 2013 12:39 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Horacio,

Would the following do the trick?

when : owner.equivalent().isUndefined()


If you need to compute the owner of a model element, x, and you're using EMF, you can use: x.eContainer

Cheers,
Louis.
Re: [Flock] Delete and element and all of its children [message #1101434 is a reply to message #1101417] Wed, 04 September 2013 13:02 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 155
Registered: October 2009
Senior Member

Hi Louis,

eContainer.equivalent() generates a null pointer exception, even with the isUndefined() method.

Cheers,


Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: [Flock] Delete and element and all of its children [message #1102103 is a reply to message #1101434] Thu, 05 September 2013 11:14 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Horacio,

Oh dear -- that doesn't sound good. Could you create a minimal example [1] and I'll take a look at the cause...

Cheers,
Louis.

[1] http://eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [Flock] Delete and element and all of its children [message #1105826 is a reply to message #1102103] Tue, 10 September 2013 10:21 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Horacio,

I've now had a chance to look at this again, and I realise that calling .equivalent() in the guard of a delete (or a retype) statement will never work! This is because it is the delete and retype statements that Flock uses to build up its equivalence table.

Instead, you can use the following:

when : owner.isKindOf(OwnerType)


Or, if the delete rule for OwnerType contains a guard:

delete OwnerType when : self.X

delete ChildType when : owner.isKindOf(OwnerType) and owner.X


Hope that helps!

Cheers,
Louis.

[Updated on: Tue, 10 September 2013 10:21]

Report message to a moderator

Re: [Flock] Delete and element and all of its children [message #1131293 is a reply to message #1105826] Thu, 10 October 2013 11:44 Go to previous message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 155
Registered: October 2009
Senior Member

Hi,

It seems Louis managed to work on this and has created a bug entry for it. If you are interested in this functionality please subscribe and helps us test this fix:

Epsilon bug 418494

Regards,


Horacio Hoyos Rodriguez
EngD Student
University Of York
Previous Topic:Eugenia Compartment Layout
Next Topic:Iterator in an attribute
Goto Forum:
  


Current Time: Thu Nov 27 07:03:44 GMT 2014

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

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