Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 #1759847] Wed, 19 April 2017 04:46 Go to next message
Venkata Santosh Lingam is currently offline Venkata Santosh LingamFriend
Messages: 6
Registered: October 2014
Junior Member
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 be called only once for all the 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;
}

In MyBuilderParticipant.java, i want to call few methods where i can do validations.


error(String message, EObject source, EStructuralFeature feature)
i was getting below exception when i call the above "error" method 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)


Is it possible to call error/warning/info method without using @Check method?

[Updated on: Wed, 19 April 2017 06:25]

Report message to a moderator

Re: Is it possible to call @Check method only once in validation [message #1759898 is a reply to message #1759847] Wed, 19 April 2017 16:17 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 748
Registered: July 2009
Location: Dortmund, Germany
Senior Member

1) No, it will be called for each instance of the declared parameter.
2) No good idea. You will miss some injections.

I don't get the reason why you want to achieve this. Sounds really unusual.
Previous Topic:is it possible to call @check method only once in validation?
Next Topic:Reduce available JvmTypes
Goto Forum:
  


Current Time: Sat Sep 18 06:36:56 GMT 2021

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

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

Back to the top