Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » @Inject usage in Xtend files
@Inject usage in Xtend files [message #918726] Fri, 21 September 2012 09:34 Go to next message
Latha Shankara is currently offline Latha ShankaraFriend
Messages: 33
Registered: June 2012
Member
Hi,

I have a custom qualified name provider 'MyDslQualifiedNameProvider'(java file) and want this to be used in one of the xtend files. I have added the below code in xtend file

@Inject
MyDslQualifiedNameProvider qualifiedNameProvider


but I get a null pointer exception. What is wrong? How can we use Guice in Xtend files?

Any help is greatly appreciated.

Thanks,
Latha
Re: @Inject usage in Xtend files [message #918739 is a reply to message #918726] Fri, 21 September 2012 09:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
Hi this works out of the box. Just make sure your instance is created
by guice

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


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: @Inject usage in Xtend files [message #918766 is a reply to message #918739] Fri, 21 September 2012 10:21 Go to previous messageGo to next message
Latha Shankara is currently offline Latha ShankaraFriend
Messages: 33
Registered: June 2012
Member
Hi Christian,

What do you mean by

Quote:

Make sure instance is created by Guice


Regards,
Latha

[Updated on: Fri, 21 September 2012 10:23]

Report message to a moderator

Re: @Inject usage in Xtend files [message #918786 is a reply to message #918766] Fri, 21 September 2012 10:45 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13885
Registered: July 2009
Senior Member
Hi,

you did not post any context how you call your xtend class.
the instance of the xtend class you use must be
created/injected with guice.
how this is best done depends on your actual usecase

~Christian


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
Previous Topic:Large Files and Excluding Directories
Next Topic:I need both ImportUriGlobalScopeProvider and TypesAwareDefaultGlobalScopeProvider in my DSL
Goto Forum:
  


Current Time: Sat Apr 17 22:11:00 GMT 2021

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

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

Back to the top