Home » Modeling » EMF Parsley » Seeing unwanted features(Tree showing unwanted children)
Seeing unwanted features [message #1692791] |
Sat, 18 April 2015 18:36  |
John Conlon Messages: 35 Registered: July 2009 |
Member |
|
|
Using a Tree View but I do not want to see all the children.
My model uses an abstract class called
Entity ->name, tag, alternateId,comments
Entity also can have one or more Event objects contained in it.
The following extend Entity:
Location -> name, tag, alternateId, ^type,comments
Person -> name, lastName, tag, alternateId, ^type,comments
Enclosure -> name, tag, alternateId, ^type,comments
Item -> name, tag, alternateId, ^type,comments
I do not want to see any Event children in my tree only the concrete extensions to Entity. (Location, Person, Enclosure,Item).
I would expect:
featuresProvider {
features {
Location -> name, tag, alternateId, ^type,comments
Person -> name, lastName, tag, alternateId, ^type,comments
Enclosure -> name, tag, alternateId, ^type,comments
Item -> name, tag, alternateId, ^type,comments
}
}
To create a tree that would NOT show any Event children to my concrete Entities, but they do show up. Is there a way to prevent the display of children in a Tree?
|
|
| | |
Re: Seeing unwanted features [message #1692991 is a reply to message #1692937] |
Tue, 21 April 2015 06:42   |
|
On 20/04/2015 19:31, John Conlon wrote:
> Hi Francesco,
>
> Closer... I tried this:
> viewerContentProvider{
> children{
>
> Location -> {^children}
> Person -> {^children}
> Enclosure -> {^children}
> Vehicle -> {^children}
>
> Item -> {""}
> Reader-> { }
> Course-> {null}
>
> }
> }
>
> The first four items can contain all the others as ^children feature
> They also can contain one or more event children. Using the notation
> above the first four elements now only display the other nodes in the
> tree. This is just what I want.
> The last three elements Item,Reader, Course, are just elements that can
> contain events. I dont want to see events in these either. I just
> can't ascertain the correct syntax to not show the event children in the
> tree. The Item -> {""} shows a space as a child, but no events thats
> better, but I would rather not see that space either. The Reader-> { }
> Course-> {null}
> still show event children.
>
> Any tips on getting ride of those unwanted 'children' events for the
> elements that only have event children?
>
Hi John
as in EMF content provider, 'children' is expected to return a List of
objects, thus, returning an empty list should do what you want.
Please keep in mind that, if you do not return a List, but a single
object, then Parsley will wrap it in a singleton list, that's why
returning "" shows an empty space as a child :)
Hope this helps
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
| |
Goto Forum:
Current Time: Sat Dec 02 05:07:34 GMT 2023
Powered by FUDForum. Page generated in 0.02510 seconds
|