Global Scoping [message #646725] |
Thu, 30 December 2010 14:35 |
Rafael Angarita Messages: 94 Registered: November 2010 |
Member |
|
|
Hello everybody! Fisrt of all, thank you for all the help you have given me.
I need to implement cross-reference for my language. For this langague, I have defined several Xtext grammars and the user will have a directory structure like the next to develop software using my language:
-parent_folder
------objects_1
------objects_2
.
.
.
-----objects_n
, where objects_1 contains the files written using my grammar 1 (language1.xtext), etc. I need to have cross-references among objects inside these directories.
I experimented with importUri mechanism explained in the post: http://blog.efftinge.de/2009/01/xtext-scopes-and-emf-index.html Sven wrote and it worked really great, but I would prefer not to have to write imports like:
import "../objects_b/myObjectb.mydslb"
, also I have a large amount of files, so it would be difficult to write all the necessary imports and keep track of them if I for example, delete an object imported in many other files.
I read the "Global Scopes Based On External Configuration (e.g. Classpath-
Based)" and the "About the Index, Containers and Their Manager" sections of the Xtext documentation but I haven't figure out how to make them work. I think I should use one of those mechanism to do what I want.
What do you think? What do you recommend me?
Thank you very much!
|
|
|
Re: Global Scoping [message #646728 is a reply to message #646725] |
Thu, 30 December 2010 15:20 |
|
Hi,
i don't understand your question since this works out of the box:
/org.xtext.example.mydsla/src/org/xtext/example/mydsl/MyDslA .xtext
grammar org.xtext.example.mydsl.MyDslA with org.eclipse.xtext.common.Terminals
generate myDslA "http://www.xtext.org/example/mydsl/MyDslA"
ModelA:
elements+=ElementA*;
ElementA:
"element" name=ID;
/org.xtext.example.mydslb/src/org/xtext/example/mydsl/MyDslB .xtext
grammar org.xtext.example.mydsl.MyDslB with org.eclipse.xtext.common.Terminals
generate myDslB "http://www.xtext.org/example/mydsl/MyDslB"
import "platform:/resource/org.xtext.example.mydsla/src-gen/org/xtext/example/mydsl/MyDslA.ecore" as mydsla
ModelB:
elements+=ElementB*;
ElementB:
"element" name=ID "refToA" refToA=[mydsla::ElementA]
;
/org.xtext.example.mydslb/src/org/xtext/example/mydsl/Genera teMyDslB.mwe2
...
fragment = ecore.EcoreGeneratorFragment {
referencedGenModels = "platform:/resource/org.xtext.example.mydsla/src-gen/org/xtext/example/mydsl/MyDslA.genmodel"
}
...
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: Global Scoping [message #646776 is a reply to message #646743] |
Fri, 31 December 2010 04:05 |
Rafael Angarita Messages: 94 Registered: November 2010 |
Member |
|
|
Ok, finally It worked! It was really that simple and out-of-the-box!
The strange part is that it worked only when I exported my Xtext project as "Deployable Plug-ins and Fragments" and installed it in Eclipse.
It has been impossible for me to make it work under the developing ("Run as Eclipse Application") environment.
Any ideas of the reasson of this problem? Maybe someone could give me a hint of what to look for in order to find out how to solve this and make the cross-reference work without the need of exporting my project.
Thank you very much.
[Updated on: Fri, 31 December 2010 04:06] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01939 seconds