Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » cross-references in grammar.(cross-references are not coming properly.)
cross-references in grammar. [message #1782850] Fri, 02 March 2018 13:26 Go to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hi,

Please find the attached Xtext grammar file and its corresponding runtime result also. I am not able to get the cross-references properly on content-assist(Ctrl+space). only single value is coming which is declared near the keyword root. I want Wordcount, Cost, and Deployments to show in content-assist also. Please suggest what am I doing wrong here?

[Updated on: Fri, 02 March 2018 13:28]

Report message to a moderator

Re: cross-references in grammar. [message #1782851 is a reply to message #1782850] Fri, 02 March 2018 13:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
did you implement IQualifiedNamePRovider to implement simple names?

does the identifer allow a "." ?
should the name be Word or Calculation.Word?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cross-references in grammar. [message #1782853 is a reply to message #1782851] Fri, 02 March 2018 14:01 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hi Christian,​

I have not implemented the interface IQuaifiedNameProvider. The name is simply a QualifiedIdentifier (in my case combination of Captial and small letters), therefore we do not need '.'. The requirement is that I need to form nested 'Feature_decl' in my grammar and should be able to see all the Feature_decl whenever I give a reference of Feature_decl in anywhere in the grammar. Only the top node is coming in the reference and I am not able to see the child or nested node.
Re: cross-references in grammar. [message #1782854 is a reply to message #1782853] Fri, 02 March 2018 14:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
the implement iqualifiednameprovider
e.g. (pseudo code)

public class MyQualifiedNameProvider extends DefaultDeclarativeQualifiedNameProvider {
public QualifiedName qualifiedName(FeatureDecl Decl) {
return QualifiedNAme.create(decl.getName());
}
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cross-references in grammar. [message #1782857 is a reply to message #1782854] Fri, 02 March 2018 14:40 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hey Christian,

I will check and let you know. Thanks for the help as always:-).
Re: cross-references in grammar. [message #1782900 is a reply to message #1782857] Sun, 04 March 2018 10:30 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello,

Just one small query. How can I get the name of the EObject? I have org.xtext.abs.impl.Feature_declImpl@74a37c91 (name: Calculations) and I want to have "Calculations" in a variable.

Thanks in advance.

[Updated on: Sun, 04 March 2018 10:31]

Report message to a moderator

Re: cross-references in grammar. [message #1782901 is a reply to message #1782900] Sun, 04 March 2018 10:44 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello,

Thank you but I got the answer. featureObj.eGet(featureObj.eClass.getEStructuralFeature("name"))
Re: cross-references in grammar. [message #1782903 is a reply to message #1782901] Sun, 04 March 2018 11:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
simply getName() ?????

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cross-references in grammar. [message #1782904 is a reply to message #1782903] Sun, 04 March 2018 11:15 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In Java, you should be able to do "featureObj.getName()"

However featureObj.eGet(featureObj.eClass.getEStructuralFeature("name")) suggests that you are using Xtend so "featureObj.name" should also work.

Regards

Ed Willink
Previous Topic:Missing src and xtend-gen source folders in xtext some projects
Next Topic:Best place to create an instance of an external referenced emf model element?
Goto Forum:
  


Current Time: Tue Apr 16 23:07:25 GMT 2024

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

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

Back to the top