|
Re: XText & Validation [message #730009 is a reply to message #730002] |
Tue, 27 September 2011 13:21 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
Xtext can automatically use EMF constraints, which may be manually coded
in Java, or defined in OCL (see OCLinEcore). In due course you may also
be able to use Xcore, I presume that graphiti can access these too.
Xtext also supports a declarative CHECKS language, but I'm not sure
whether that is readily accessible outside Xtext.
Regards
Ed Willink
On 27/09/2011 14:03, Matteo wrote:
> Hi,
>
> I'm relatively new to XText & the whole Eclipse Modeling world.
>
> I have to create an RCP application that provides the user with
> several ways to edit a model, including a textual editor (here I
> thought of XText) and a graphical one (I'm going to use graphiti).
>
> The model itself has several semantic constraints, hence I have to
> provide some validation rules. There are simple constraints (for
> example those on the ID) and complex ones (e.g., the graph represented
> by the model must be acyclic).
>
> I discovered that both EMF and XText provide support for validation,
> and I was wondering which is the one I should use. I would like to
> write the validation rules once and be able to use them both in the
> graphical editor and in the textual editor.
>
> Does anybody have any suggestion?
|
|
|
Re: XText & Validation [message #730377 is a reply to message #730002] |
Wed, 28 September 2011 09:26 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Xtext offers a Java annotation based framework to add validation rules
for your DSL. Personally, I'd recommend this as it's realtively easy to
grasp for Java developers, IDE integrated, performs well, and reduces
the amount of boiler plate code necessary in other frameworks. The
validator is registered with EMF's low-level API for EValidators, so
they should work in any context (e.g. graphical, textual or tree editors).
Check (form the Xpand project) is a DSL for validation with an adapter
to register it to EMF, but is somehow outdated. There is also OCL, EMF
Validation and GMF's audit rules.
So in the end it's a matter of taste which framework you use as long as
they comply to the basic EMF mechanisms.
Am 27.09.11 15:03, schrieb Matteo:
> Hi,
>
> I'm relatively new to XText & the whole Eclipse Modeling world.
>
> I have to create an RCP application that provides the user with several
> ways to edit a model, including a textual editor (here I thought of
> XText) and a graphical one (I'm going to use graphiti).
>
> The model itself has several semantic constraints, hence I have to
> provide some validation rules. There are simple constraints (for example
> those on the ID) and complex ones (e.g., the graph represented by the
> model must be acyclic).
>
> I discovered that both EMF and XText provide support for validation, and
> I was wondering which is the one I should use. I would like to write the
> validation rules once and be able to use them both in the graphical
> editor and in the textual editor.
>
> Does anybody have any suggestion?
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
|
Re: XText & Validation [message #730988 is a reply to message #730971] |
Thu, 29 September 2011 16:25 |
|
Hi,
(1) the validation is called by xtexts org.eclipse.xtext.validation.IResourceValidator
(2) why not simply navigating from one object to the others? or placing the validation rule at the root element of the dsl? this is how it ususally is done.
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Powered by
FUDForum. Page generated in 0.03249 seconds