Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Epsilon getAllChildren or getAllContents for EMF based models
Epsilon getAllChildren or getAllContents for EMF based models [message #1471980] Thu, 13 November 2014 13:49 Go to next message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo HerreraFriend
Messages: 260
Registered: July 2009
Senior Member
Hi Folks,

In your Epsilon based scripts/transformations you can't directly work with EMF API dealing with TreeIterators, so that calling eAllContents() or using the EmfTool.getEcoreUtil().getAllContents() will always return you an empty collection.

However after some discussion Dimitris, who pointed out that eContents() indeed return the list of first deep children, you can combine it with a closure operation to simulate the eAllContents operation. The expression would be the following

myModelElement.asSequence().closure(x | x.eContents());

Just sharing, in case somebody else needed the same handy operation.

[NB this is a kind of solution for EMF based models. I think that this should be part of the language as model element built-in operation. Similar with getContents() or getContainer(). Enhancement request ? Razz]

Cheers,
Adolfo.
Re: Epsilon getAllChildren or getAllContents for EMF based models [message #1471994 is a reply to message #1471980] Thu, 13 November 2014 14:01 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Adolfo,

Thanks for sharing this. I've created a how-to page in the wiki and added this tip there [1]. By all means please feel free to file an enhancement request for this.

Cheers,
Dimitris

[1] https://wiki.eclipse.org/Epsilon/HowTo
Previous Topic:Release notes for Epsilon 1.2
Next Topic:[Emfatic] Error while importing ecore
Goto Forum:
  


Current Time: Wed Apr 24 15:03:47 GMT 2024

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

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

Back to the top