Skip to main content



      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 02:08 Go to next message
Eclipse UserFriend
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 07:09 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: How to display ecore Eclass names for content assist in Xtext editor after generating artifacts [message #1014060 is a reply to message #1012894] Sun, 24 February 2013 23:18 Go to previous messageGo to next message
Eclipse UserFriend
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: Sun, 24 February 2013 23:28] by 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 01:50 Go to previous messageGo to next message
Eclipse UserFriend
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
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 02:12 Go to previous messageGo to next message
Eclipse UserFriend
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 02:44 Go to previous messageGo to next message
Eclipse UserFriend

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());
	}

}



[Updated on: Mon, 25 February 2013 02:45] by 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 04:22 Go to previous messageGo to next message
Eclipse UserFriend
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 02:21 Go to previous messageGo to next message
Eclipse UserFriend
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 02:32] by 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 03:06 Go to previous message
Eclipse UserFriend
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
Previous Topic:Working With a User Generated Script
Next Topic:Recursive imports in xtext
Goto Forum:
  


Current Time: Tue Jul 08 06:00:26 EDT 2025

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

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

Back to the top