|Re: OAW to TMF migration: ext allElements migration [message #64716]
||Tue, 21 July 2009 07:16
| Sebastian Zarnekow
Registered: July 2009
as this question is related to m2t I include the right newsgroup in this
reply. allElements() was a serious performance trap in oAW 4.3.1 as it
was kind of easy to use in combination with typeSelect - the same way
you describe it - but used to collection everthing to select a small
number of objects afterwards. That is basically a bad idea from the
complexity point of view. That's why there is no such function in Xtext.
You may want to write it on your own with the help of
EcoreUtil.getAllContents(ResourceSet). You can filter the elements with
Google Collection API. Have a look for Iterables.filter(Iterable,
Class). You'll find an example if you search the m2t newsgroup for
Literally speaking it is almost ever a better idea to navigate the tree
directly and collect only the interesting objects in the first place.
Please consider to rewrite your checks to be more straight forward
intead of using the generic allElements-approach.
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 20.07.2009 23:16 Uhr, schrieb Marcel Wagner:
> I try to migrate my OAW xtext projects to the new TMF xtext base. I have
> some trouble to migrate my checks to the java based checks. I search for
> a function to get all elements of the parsed DSL including the included
> DSL files. In OAW xtext, there was a generated extension called
> allElements() where I get all parsed elements of the DSL files. This
> function was used heavily in my checks in combination with typeSelect().
> My question now, is there a similar function in TMF to get all elements
> of the parsed DSL including the included DSL files? And how can I filter
> on this set to get only elements of a given DSL type?
> Thanks for the help,
Powered by FUDForum
. Page generated in 0.03425 seconds