Skip to main content



      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 08:49 Go to next message
Eclipse UserFriend
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 09:01 Go to previous message
Eclipse UserFriend
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: Mon Jul 14 07:23:50 EDT 2025

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

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

Back to the top