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 07:22 Go to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 140
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 08:39 Go to previous messageGo to next message
Louis Rose is currently offline Louis Rose
Messages: 436
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 09:02 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 140
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 07:14 Go to previous messageGo to next message
Louis Rose is currently offline Louis Rose
Messages: 436
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 06:21 Go to previous message
Louis Rose is currently offline Louis Rose
Messages: 436
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 06:21]

Report message to a moderator

Previous Topic:org.eclipse.epsilon.emc.emf.virtual problem
Next Topic:Cant Generate diagram Tools
Goto Forum:
  


Current Time: Mon Oct 07 08:44:03 EDT 2013

Powered by FUDForum. Page generated in 0.10334 seconds