Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using a customized XbaseValidator
Using a customized XbaseValidator [message #1768739] Sun, 23 July 2017 08:55 Go to next message
Marco Ullrich is currently offline Marco UllrichFriend
Messages: 14
Registered: December 2016
Location: Bayreuth
Junior Member
Hello everyone,

I want to customize Xbase, so that assignments to parameters are possible.
I already customized the JvmModelGenerator to generate the appropriate code and it works.
But I also need to customize the validation of Xbase.
I did subclass the XbaseValidator and customized the checkAssignment method.
My problem is: How do i inject my customized XbaseValidator instead of the original one?

I already subclassed and customized th XbaseRuntimeModule:
class BpoXbaseRuntimeModule extends XbaseRuntimeModule {
	
	@SingletonBinding(eager=true)
	override Class<? extends XbaseValidator> bindXbaseValidator() {
		return BpoXbaseValidator;
	}
	
}


and the XbaseStandaloneSetup:
class BpoXbaseStandaloneSetup extends XbaseStandaloneSetup{
	override Injector createInjector() {
		return Guice.createInjector(new BpoXbaseRuntimeModule());
	}
	
	def static void doSetup() {
		new BpoXbaseStandaloneSetup().createInjectorAndDoEMFRegistration()
	}
}


But my validator is not injected during runtime.
Do I have to customize another part?
How does the runtime know wich StandaloneSetup to use?

Thanks in advance and best regards,
Marco

[Updated on: Sun, 23 July 2017 08:56]

Report message to a moderator

Re: Customizing assignement to parameters in Xbase [message #1768740 is a reply to message #1768739] Sun, 23 July 2017 08:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14078
Registered: July 2009
Senior Member
Hi

You should add the bindings to the pregenerated runtimemodule.
You should override the bindYourdslValidator method


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Customizing assignement to parameters in Xbase [message #1768742 is a reply to message #1768740] Sun, 23 July 2017 09:48 Go to previous message
Marco Ullrich is currently offline Marco UllrichFriend
Messages: 14
Registered: December 2016
Location: Bayreuth
Junior Member
Oh, it seems i over complicated things...
Overriding the checkAssignment-Method in the default- Validator did the trick, hence it inherits from XbaseValidator.
Thank you for setting me back on track Christian!

Have a nice day! :)
Previous Topic:Github Pull Requests
Next Topic:Unable to resolve some references in .mwe2 file
Goto Forum:
  


Current Time: Mon Oct 25 08:29:22 GMT 2021

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

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

Back to the top