Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Suggest feature only if another feature exists
Suggest feature only if another feature exists [message #934153] Fri, 05 October 2012 18:02 Go to next message
Artem G. is currently offline Artem G.Friend
Messages: 10
Registered: October 2012
Junior Member
Hi folks,

I have a particular situation, where I'd like to suggest/add to autocomplete/successfully validate/ a particular dependent feature only if another feature already exists. For example:

Grammer:
Model:
    ('datatype' ':' datatype = DataType)? &
    ('maxValue' ':' maxValue = INT)? &
    ('minValue' ':' minValue = INT)? &
    ('stringLength' ':' stringLength = INT)? &
    ('binary' ':' binary = Bool)? &
;
enum DataType:
    INT = 'Integer' | STRING = 'String'
;
enum Bool:
    TRUE = '1' | FALSE = '0'
;


So,
1. I'd like to let user use random order for all this features (therefore &)
2. Until no datatype added, suggest/autocomplete only binary feature.
3. If
datatype: String
suggest/autocomplete only stringLength feature, if
datatype: Integer
suggest/autocomplete only minValue and maxValue features.

Any help appreciated!
Re: Suggest feature only if another feature exists [message #934174 is a reply to message #934153] Fri, 05 October 2012 18:24 Go to previous message
Michael A. is currently offline Michael A.Friend
Messages: 8
Registered: June 2012
Junior Member
I had some trouble in the past using & - maybe my fault, but I am not using it anymore. I would introduce an enum covering all your features min, max, etc, then introduce a list of subnodes in your model (KeyEnum, Value) - one for each feature and then I'd implement the behaviour you've described using the completion assistant and checks.
Opinions?

Micha
Previous Topic:Problem after eclipse update to 4.2.1
Next Topic:Scoping Question (Beginner)
Goto Forum:
  


Current Time: Wed Apr 24 23:05:53 GMT 2024

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

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

Back to the top