Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » get name of referenced object when there is an error
get name of referenced object when there is an error [message #658917] Thu, 10 March 2011 12:58 Go to next message
No real name is currently offline No real nameFriend
Messages: 11
Registered: November 2010
Junior Member
Hi,

I have a grammar in which a object Attribute reference another object Domain like this

Attribute:
domain= Domain

I use Attribute.getdomain() to get all the information from the domain.

My problem is that when the domain referenced doesn't exists xtext marks it as an error and return an object with all the fields null.

I want to know if there is a way to get the name of the domain that was written in the object Attribute when the domain doesn't actually exists ?.


Thanks.
Re: get name of referenced object when there is an error [message #658927 is a reply to message #658917] Thu, 10 March 2011 13:30 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

I think you could try to use NodeUtil.getNodeAdapter(EObject) and evaluate the node at this position.

Kind regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: get name of referenced object when there is an error [message #659780 is a reply to message #658927] Tue, 15 March 2011 15:18 Go to previous message
No real name is currently offline No real nameFriend
Messages: 11
Registered: November 2010
Junior Member
Thanks for answering .

I found the name using

EList<LeafNode> list = NodeUtil.getNodeAdapter(attribute).getParserNode().getLeafNo des();

And iterating over the list.
It works but its not very good, since y have to iterate over the list which has a node for every word in the text.

If anyone has a better solution , it good be great.

thanks
Previous Topic:minor bug with var in Generator.exapand
Next Topic:Xtext project from an existing ecore model : generation impossible
Goto Forum:
  


Current Time: Fri Apr 26 06:37:45 GMT 2024

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

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

Back to the top