Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Entry & Validation of Text in a GMF Runtime(Entry & Validation of Text in a GMF Runtime)
Entry & Validation of Text in a GMF Runtime [message #1115150] Mon, 23 September 2013 14:38 Go to next message
Greg Dart is currently offline Greg Dart
Messages: 17
Registered: September 2013
Junior Member
Hi,

Please help me set out in the correct direction: I have used Epsilon to create a GMF runtime based on Emfatic using Eugenia. This includes EVL constaints which are pre-defined and validated as the user creates a model.

Now I need to allow the user to define textual rules in the model at runtime, and have these validated against the model. I would like the validation to show where the text references model elements, and where it doesn't. For example if the metamodel includes engine, gearbox, wheel, and the user creates a model of one engine, one gearbox and four wheels, the text rule might be "Engine1 + gearbox3 < 200hp". I would like the validation to show that "Engine1" and "Gearbox3" are model elements but that " < 200hp" is user defined and it does conform to a valid syntax.

Is EVL an appropriate starting point for this? Or should I explore xtext first? Could you give me an outline as to how to tackle this? Do I need to implement a "listener" for this - if so where do I start?

Thanks very much in advance...

Greg
Re: Entry & Validation of Text in a GMF Runtime [message #1115651 is a reply to message #1115150] Tue, 24 September 2013 07:42 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 840
Registered: July 2009
Senior Member
Hi Greg,

What you're describing is a DSL that has a hybrid graphical/textual syntax. EVL - or more likely EOL - could be embedded as an expression language in your DSL but then any expressions/constraints would have to conform to EOL's syntax (e.g. 200hp wouldn't work).

Another alternative is to use a mixture of GMF/Xtext to specify the different concrete syntaxes and glue them together. A working example of doing this for an executable state machine DSL is available in the org.eclipse.epsilon.eugenia.examples.executablestatemachine.* projects under [1]. If you opt for this approach you'll need to implement the execution semantics of your textual constraint language from scratch. Xtend [2] may provide some reusable execution components but I know just enough about it to be dangerous.

Cheers,
Dimitris

[1] https://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/trunk/examples/
[2] http://www.eclipse.org/Xtext/documentation.html#JvmDomainmodel
Re: Entry & Validation of Text in a GMF Runtime [message #1116271 is a reply to message #1115651] Wed, 25 September 2013 03:15 Go to previous messageGo to next message
Greg Dart is currently offline Greg Dart
Messages: 17
Registered: September 2013
Junior Member
Thanks Dimitris - that's what I'd suspected but it's good to have it confirmed. Also I hadn't appreciated the relevance of the executable state machine example, so I'll have a look at that.

Thanks again,
Greg
Re: Entry & Validation of Text in a GMF Runtime [message #1117851 is a reply to message #1115651] Thu, 26 September 2013 17:43 Go to previous messageGo to next message
Greg Dart is currently offline Greg Dart
Messages: 17
Registered: September 2013
Junior Member
Hi Dimitris,

Is there any documentation/explanation available to go with the executable state machine example? I can create a state machine diagram (and label it), and I can create an "test.esm_actions" xtext file which gives me a language specific editor, but I can't get the two to work together! It's probably obvious but perhaps I can't see the wood for the trees and I've googled to no avail...

Thanks,
Greg
Re: Entry & Validation of Text in a GMF Runtime [message #1117898 is a reply to message #1117851] Thu, 26 September 2013 18:52 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 840
Registered: July 2009
Senior Member
Hi Greg,

I've forwarded this to my colleague (Louis Rose) who has developed this example.

Cheers,
Dimitris
Re: Entry & Validation of Text in a GMF Runtime [message #1125332 is a reply to message #1117898] Fri, 04 October 2013 07:58 Go to previous message
Louis Rose is currently offline Louis Rose
Messages: 439
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Greg,

Are you perhaps using Kepler (Eclipse 4.3)? If so, I think that you'll need to use a slightly newer version of the example, which I've just committed to our SVN repository [1]. If you're using Eclipse Juno (4.2), the version you already have should work. If not, you could try regenerating the GMF code for the precise version of GMF that you have installed, by selecting the esm.emf file, right-clicking and then selecting Eugenia > Generate GMF editor.

Also, for this example to work, do be sure that you edit the transition's text by double-clicking on the labels in the canvas, rather than via the property sheet view. This example only binds the Xtext parser to the label editor used on the GMF editor's canvas. The property sheet view is contributed by a plug-in which is generated by EMF rather than Eugenia, so we don't currently have a good way to repeatedly edit the behaviour of the property sheet view.

I've attached a video showing how the example works. First, I change the label on the transition and we see that this change is reflected by the addition of a "Dec" element in the model. This "Dec" object is an instance of a class from the metamodel generated from the Xtext grammar. Then, I show that the label editor won't allow invalid statements such as "foo" to be set as transition labels. Finally, I show that the property sheet editor doesn't perform validation and will allow "foo" to be set as a transition label.

Hope this helps!

Cheers,
Louis.

[1] https://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/trunk/examples/

[Updated on: Fri, 04 October 2013 08:02]

Report message to a moderator

Previous Topic:Error "Type 'A!B' not found in .etl code!"
Next Topic:What causes this error?
Goto Forum:
  


Current Time: Sun Aug 31 06:35:22 EDT 2014

Powered by FUDForum. Page generated in 0.01863 seconds