Skip to main content



      Home
Home » Modeling » TMF (Xtext) » is it possible to call @check method only once in validation?(is it possible to call @check method only once in validation)
icon5.gif  is it possible to call @check method only once in validation? [message #1759870] Wed, 19 April 2017 06:12 Go to next message
Eclipse UserFriend
I have created xtext project with MyDSL grammar.

1. In my project, i have 10 mydsl files with same data( for some reason i have segregated to 10 files). But when we clean the project i want @Check method in validation to call only once for all files.

Is it possible to call the @Check method only once for all the 10 dsl files?



2. And i tried Calling Validator class from BuilderParticipant without @Check method in validation.

@Override
public Class<? extends IXtextBuilderParticipant> bindIXtextBuilderParticipant() {
return MyBuilderParticipant.class;
}

error(String message, EObject source, EStructuralFeature feature)
i was getting below exceptithoon when i call the above "error" med with out @Check method



!MESSAGE org.eclipse.xtext.builder.impl.XtextBuilder -

!STACK 0
java.lang.NullPointerException
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.acceptError(AbstractDeclarativeValidator.java:555)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:441)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:431)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.error(AbstractDeclarativeValidator.java:427)
at com.bosch.tt.sitt.spec.validation.CustomSpecValidator.issue(CustomSpecValidator.java:66)
at com.bosch.tt.sitt.spec.validation.CustomSpecValidator.issue(CustomSpecValidator.java:17)
at com.bosch.tt.sitt.spec.validation.SpecValidator.validate(SpecValidator.java:41)
at com.bosch.tt.sitt.spec.ui.SpecBuilderParticipant.buildProject(SpecBuilderParticipant.java:74)
at com.bosch.tt.sitt.spec.ui.SpecBuilderParticipant.build(SpecBuilderParticipant.java:36)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant$DeferredBuilderParticipant.build(RegistryBuilderParticipant.java:161)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:69)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:291)
at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:319)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:155)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:144)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Re: is it possible to call @check method only once in validation? [message #1759883 is a reply to message #1759870] Wed, 19 April 2017 10:36 Go to previous messageGo to next message
Eclipse UserFriend
You could do the validation only for the first resource in the resourceSet.resources list.
E.g. something like
if (resource.resourceSet.resources.head === resource) {
   // do validation
}
Re: is it possible to call @check method only once in validation? [message #1759885 is a reply to message #1759883] Wed, 19 April 2017 10:40 Go to previous message
Eclipse UserFriend
For the second part. You cannot directly call an individual check method if it uses any of the convenience methods from the super class.
As It is expected that those methods are reflectively called through the 'invoke' function, which set some contextual state in a thread local.
Previous Topic:Xtext good pracitces
Next Topic:Is it possible to call @Check method only once in validation
Goto Forum:
  


Current Time: Fri Nov 07 11:59:14 EST 2025

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

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

Back to the top