Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Disable validation of imported metamodel
Disable validation of imported metamodel [message #1172003] Tue, 05 November 2013 16:31 Go to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hello,

I would like to know if it is possible to disable the validation for a subset of modelelements which are specified in the metamodel.

The problem is that I'm getting some validation-errors from the Xtexteditor while writting my dsl-file. So my idea is to disable the validation for exactly this modelelement.
I try to build a real simple textual notation and want to serialize the (valid) model while saving the file. The saved model is modified during the saving process, so it is
valid at the end.

Regards,
Alex
Re: Disable validation of imported metamodel [message #1173347 is a reply to message #1172003] Wed, 06 November 2013 13:03 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Hello,

is it maybe possible to override the default-errors (which are caused from the imported metamodel in the grammarfile) by extending the AbstractMyDslValidator?

~Alex
Re: Disable validation of imported metamodel [message #1173668 is a reply to message #1173347] Wed, 06 November 2013 17:28 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Think there is an option to postpone some validation until the save.
IIRC there is a .normal attribute for the standard behaviour.
I tried to google it, but got no meaningful hint
Re: Disable validation of imported metamodel [message #1174803 is a reply to message #1173668] Thu, 07 November 2013 10:16 Go to previous messageGo to next message
Alexander R is currently offline Alexander RFriend
Messages: 211
Registered: July 2013
Senior Member
Thanks for the hint.
Re: Disable validation of imported metamodel [message #1174867 is a reply to message #1173668] Thu, 07 November 2013 11:09 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 250
Registered: June 2013
Senior Member
Found an example in the book from Markus Völter (dslbook.org)
DSL Engineering
Designing, Implementing and Using
Domain-Specific Languages
on page 242:

•CheckType.NORMAL: run when the file is saved.
•CheckType.FAST: run after each model change (more or less after each keypress).
•CheckType.EXPENSIVE: run only if requested explicitly via the context menu.

@Check(CheckType.NORMAL)
publicvoidcheckOrphanEndState( CustomState ctx ) {
CoolingProgram coopro = Utils.ancestor(ctx, CoolingProgram.class);
TreeIterator<EObject> all = coopro.eAllContents();
while( all.hasNext() ) {
EObject s = all.next();
if(sinstanceofChangeStateStatement ) {
ChangeStateStatement css = (ChangeStateStatement) s;
if( css.getTargetState() == ctx )return;
}
}
error("no transition ever leads into this state",
CoolingLanguagePackage.eINSTANCE.getState_Name());
}

[Updated on: Thu, 07 November 2013 11:18]

Report message to a moderator

Previous Topic:Generic DSL based on POJO
Next Topic:Generate Eclipse Application
Goto Forum:
  


Current Time: Tue Apr 16 19:38:23 GMT 2024

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

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

Back to the top