Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Parsley » Problem showing Derived Features(Can't visualize derived features)
Problem showing Derived Features [message #1691407] Tue, 07 April 2015 05:28 Go to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Have derived attributes in some of my classes, (Ecore Feature Derived to true) but I can not get them to show up in forms or tables.

They are in my Properties View, so I know the Edit plugin is working and my model is set up ok, but they do not show in any of the Parsley Selected Form or Table views.


Is this a bug, or am I neglecting to do something in the DSL?
Re: Problem showing Derived Features [message #1691482 is a reply to message #1691407] Tue, 07 April 2015 14:32 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 07/04/2015 07:28, John Conlon wrote:
> Have derived attributes in some of my classes, (Ecore Feature Derived to
> true) but I can not get them to show up in forms or tables.
> They are in my Properties View, so I know the Edit plugin is working and
> my model is set up ok, but they do not show in any of the Parsley
> Selected Form or Table views.
>
> Is this a bug, or am I neglecting to do something in the DSL?

Hi

did you customize the featuresProvider?
If you have a custom features provider listing the features explicitly,
the Parsley will use all the features you specified; if this is not the
case, then the default behavior is to filter out derived and containment
features (this looks like a sensible general default behavior).

This is implemented in
org.eclipse.emf.parsley.ui.provider.FeaturesProvider.defaultFeatures(EClass)

protected List<EStructuralFeature> defaultFeatures(EClass eClass) {
EList<EStructuralFeature> eAllStructuralFeatures =
eClass.getEAllStructuralFeatures();
Collection<EStructuralFeature> features =
Collections2.filter(eAllStructuralFeatures, new
Predicate<EStructuralFeature>() {

public boolean apply(EStructuralFeature feature) {
// derived, unchangeable, container and containment features ignored
return feature.isChangeable()
&& !feature.isDerived()
&& !(feature instanceof EReference && (((EReference) feature)
.isContainment()
));
}
});
return new BasicEList<EStructuralFeature>(features);
}

So, either you customize this Java method, or you list all the features
you want in the custom featuresProvider.

Does that help?
cheers
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


Re: Problem showing Derived Features [message #1691532 is a reply to message #1691482] Tue, 07 April 2015 23:17 Go to previous messageGo to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Quote:
did you customize the featuresProvider?
If you have a custom features provider listing the features explicitly,
the Parsley will use all the features you specified


Yes that does it. Customizing the featuresProvider in the DSL then shows the derived feature. Thanks...
Re: Problem showing Derived Features [message #1691587 is a reply to message #1691532] Wed, 08 April 2015 10:40 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 08/04/2015 01:17, John Conlon wrote:
> Quote:
>> did you customize the featuresProvider?
>> If you have a custom features provider listing the features explicitly,
>> the Parsley will use all the features you specified
>
>
> Yes that does it. Customizing the featuresProvider in the DSL then
> shows the derived feature. Thanks...

By the way, after writing to you, I discovered a small bug

https://bugs.eclipse.org/bugs/show_bug.cgi?id=464064

it's already fixed it, but not yet released (if you need to fix you have
to use the latest update site, but that will also require Xtext 2.8.1,
since I've also ported Parsley DSL to the new version of Xtext).

cheers
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


Previous Topic:Add a column to a Table
Next Topic:Menus that call a Wizard
Goto Forum:
  


Current Time: Fri Apr 26 19:50:53 GMT 2024

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

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

Back to the top