Home » Modeling » EMF Parsley » Problem showing Derived Features(Can't visualize derived features)
|
Re: Problem showing Derived Features [message #1691482 is a reply to message #1691407] |
Tue, 07 April 2015 14:32   |
|
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
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
|
|
| |
Re: Problem showing Derived Features [message #1691587 is a reply to message #1691532] |
Wed, 08 April 2015 10:40  |
|
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
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: Mon Dec 04 00:16:31 GMT 2023
Powered by FUDForum. Page generated in 0.02204 seconds
|