Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Parsley » Show or hide logic in FeatureCaptionProvider(How to check a preference and determine to show or hide features)
Show or hide logic in FeatureCaptionProvider [message #1694794] Thu, 07 May 2015 23:23 Go to next message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
In the DSL is it possible to hide or show features based on a user preference like below?

featureCaptionProvider{
		val store = PerspectivePlugin.getDefault().getPreferenceStore();
		val hideGeoLocations = store.getBoolean(PreferenceConstants.P_HIDE_GEO_LOCATION);
		
   	 text {
   	 	Location : name -> 'Location Name:'
   	 	Location : tag -> 'Primary Tag ID:'
   	 	Location : alternateId -> 'Alternate ID:'
   	 	Location : ^type -> 'Type of Location:'
   	 	Location : description -> 'Description:'
   	 	
   	 	// Hide or show these values based on hideGeoLocations val
   		Location : boundary -> 'Perimeter boundary as Geo Polygon Coordinates:'
   	 	Location : latitude -> 'Latitude:'
   	 	Location : longitude-> 'Longitude:'
   	 	Location : altitude-> 'Altitude:'
   	 	Location : altitudeMode -> 'Altitude Mode:'
   	 	
Re: Show or hide logic in FeatureCaptionProvider [message #1694880 is a reply to message #1694794] Fri, 08 May 2015 16:03 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1750
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 08/05/2015 01:23, John Conlon wrote:
> In the DSL is it possible to hide or show features based on a user
> preference like below?
>
>
> featureCaptionProvider{
> val store = PerspectivePlugin.getDefault().getPreferenceStore();
> val hideGeoLocations =
> store.getBoolean(PreferenceConstants.P_HIDE_GEO_LOCATION);
>
> text {
> Location : name -> 'Location Name:'
> Location : tag -> 'Primary Tag ID:'
> Location : alternateId -> 'Alternate ID:'
> Location : ^type -> 'Type of Location:'
> Location : description -> 'Description:'
>
> // Hide or show these values based on hideGeoLocations val
> Location : boundary -> 'Perimeter boundary as Geo Polygon
> Coordinates:'
> Location : latitude -> 'Latitude:'
> Location : longitude-> 'Longitude:'
> Location : altitude-> 'Altitude:'
> Location : altitudeMode -> 'Altitude Mode:'
>

Hi John

if you need to completely hide the features, you should customize the
featuresProvider: the featureCaptionProvider only specifies the labels
for form and dialog fields.

However, currently, there's no way to specify features in the
featuresProvider in a conditional way in the DSL: you can only return
the features for a given EClass, but not based on a condition; you could
however implement a custom FeaturesProvider directly in Java, see the
"Features Provider" section in the documentation (and bind it either in
the Java Guice module, or in the DSL using the 'bindings' section).

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: Show or hide logic in FeatureCaptionProvider [message #1694909 is a reply to message #1694794] Sat, 09 May 2015 00:53 Go to previous message
John Conlon is currently offline John ConlonFriend
Messages: 35
Registered: July 2009
Member
Hi Lorenzo,

Yes, that worked. I did as you suggested and implemented a FeaturesProvider directly in Java.

thanks again for the help,
John
Previous Topic:Seeing unwanted features
Next Topic:Adding an operation to a Form
Goto Forum:
  


Current Time: Mon Aug 20 01:24:36 GMT 2018

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

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

Back to the top