|
Re: global validation [message #1721453 is a reply to message #1721426] |
Wed, 27 January 2016 15:02 |
|
Actually you can produce multiple errors from a check for type ModelRoot. Collect all references to an refered-to element and produce an error for each if you find more than once. Basically you could create a multimap while traversing the model instance.
Things become more complicated when the referred-to elements are split over several resources, which I guess is what you have. In this case you have to know from a referred-to element if there is only one referrer. Since there is only a unidirectional dependency from referrer to referred-to, you will have to somehow collect the cross-references.
I could imagine that you would be able to install an org.eclipse.emf.ecore.util.ECrossReferenceAdapter on a referred-to element during the linking phase when a referrer to its referred-to is linked. This might be done by subclassing the DefaultLinkingService
Validation happens after linking. Thus your validation could get the ECrossReferenceAdapter from the referred-to element and check if there are more than one cross references.
Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
|
|
|
Powered by
FUDForum. Page generated in 0.03528 seconds