Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to display ecore Eclass names for content assist in Xtext editor after generating artifacts ?(Content Assist for EClass + EStructuralFeature from external Ecore)
How to display ecore Eclass names for content assist in Xtext editor after generating artifacts ? [message #1012747] Fri, 22 February 2013 07:08 Go to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Aim: To provide editor for configuring a pattern rule for Fruits.ecore

DSL Rule will some thing like this "A Grade" + Apple.name

Problem:
With new instance of eclipse application I created a sample project and created a file with text.fruit within this editor I need to creat my new Fruit rule

EClass name and EStructural feature as my content assist

When I do Ctrl + Space my expectations to get list as content assist

Apple
Orange

Steps taken:

1. Created an xtext plug-in with extension .fruit as my fruit.xtext as dsl.

2. Using import statement in my "fruit.xtext" file

3. import "platform:/resource/com.emf.sample/model/Fruits.ecore" as ecore

4. Within fruit.xtext content assist of ecore works
Now generate Xtext artificats and run the application should provide content assist for EClass and EStructural Feature



How to add external ecore as part of Content assist in Work Flow or Grammar of xtext editor ? Any sample examples or work around will help .

Thanks
Sri
Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1012894 is a reply to message #1012747] Fri, 22 February 2013 12:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i am not quite sure what you are doing. can you provide your complete grammar and ecore?
it seems you are mixing up some metalevels

if you want to use eclasses and estructural features in your grammar why do you import fruit.ecore then?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1014060 is a reply to message #1012894] Mon, 25 February 2013 04:18 Go to previous messageGo to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi Christian,

I am already importing it in Fruit.ecore in my grammar file. But the problem is when i generate all artifacts and build the product. My end dsl will be Apple.fruit . For this i need the content as in my grammar file.

Fruit.xtext (Grammar file)

import "platform:/resource/com.emf.sample/model/Fruits.ecore" as ecore



Apple.fruit(End dsl file)

I need content assist to provide a rule

Apple.name

Where Apple is the Eclass and name is Estructural Feature

Similar kind of requirement is what i am looking

http://www.eclipse.org/forums/index.php?&t=msg&th=166470

Thanks,
Sri



[Updated on: Mon, 25 February 2013 04:28]

Report message to a moderator

Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1014099 is a reply to message #1014060] Mon, 25 February 2013 06:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i still do not get it. in this case you do not import a special ecore file in the grammar.
you simply put the ecore file next to your test.mydsl file

the rest will work out of the box with a simple adoption of scoping.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1014108 is a reply to message #1014099] Mon, 25 February 2013 07:12 Go to previous messageGo to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi Christian,

Thanks for your reply , Is there any example for the same for adapting scoping pretty new to Xtext. Tutorials for the same .

Regards,
Sri
Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1014118 is a reply to message #1014108] Mon, 25 February 2013 07:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member

Model:
	"EClass:" theEClass=[ecore::EClass|FQN] "Feature:" theFeature=[ecore::EStructuralFeature];	
FQN: ID("." ID)*;


public class MyDslscopeProvider extends AbstractDeclarativescopeProvider {
	
	public Iscope scope_Model_theFeature(Model model, EReference ref) {
		return scopes.scopeFor(model.getTheEClass().getEAllStructuralFeatures());
	}

}





Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 25 February 2013 07:45]

Report message to a moderator

Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1014159 is a reply to message #1014118] Mon, 25 February 2013 09:22 Go to previous messageGo to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi Christian ,

Thanks for your reply .. It did work only if i have my ecore present in the project. Is there any way where i could implicitly register my ecore programmatically ?


Regards,
Sri

Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1017204 is a reply to message #1014159] Mon, 11 March 2013 06:21 Go to previous messageGo to next message
Srinivas MV is currently offline Srinivas MVFriend
Messages: 16
Registered: February 2013
Junior Member
Hi Christian ,

How to load/import by nsURI the ecore and then accessing it.. Is there any kind of registration mechanism . And make the EPackage available for content assist. Instead of adding each time the ecore to my project.

I would like to embed this xtext editor to my preference page. Where i need to configure certain rules from my ecore Eclasses.

Regards,
Sri

[Updated on: Mon, 11 March 2013 06:32]

Report message to a moderator

Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1017208 is a reply to message #1017204] Mon, 11 March 2013 07:06 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I I basically think you did not get what cross references are. If you
do not want to have them generate the java code for the ecore, change
the grammar to use strings, and use java to fill the content assist.

Since I have no clue what your use case is it is hard to say what to
recommend to do

--
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Working With a User Generated Script
Next Topic:Recursive imports in xtext
Goto Forum:
  


Current Time: Tue Apr 23 17:59:08 GMT 2024

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

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

Back to the top