Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » problems with global scoping(local scoping works fine, but if I want to reference something from another file it does not work)
problems with global scoping [message #1699239] Mon, 22 June 2015 21:56 Go to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
I have created a xtext project with the eclipse wizard.
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations

generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"

Model:
	'package' name = QualifiedName
	(imports = XImportSection)?
	content +=Content*
;	
	
Content:
	TypeDef|TypeRef
;
TypeDef:
	'def' name=ValidID type=JvmTypeReference 'length' length=INT
;

TypeRef:
	'ref' name=ValidID ('extends' superType=[TypeRef|QualifiedName])? 
	types += TypeRefValDef*
;

TypeRefValDef:
	'val' name=ValidID type=[TypeDef|QualifiedName]
;


Now running the dsl as eclipse project adding the following to files:
package test

def def1 String length 10

ref Ref1 
val d def1

package test

ref Ref extends test.Ref1

In the last I get the message Couldn't resolve reference to TypeRef 'test.Ref1'.

I read lots about GlobalScopeProvider, XtextResourceDescriptionStrategy, ... etc., and I think I start to understand the big picture,
I have the strange feeling, that the ResourceDecriptions (Index) is not build correctly.
When I try to read allResourceDescriptions from the ResourceDescriptionsProvider I get an empty List.

I have no idea what I am missing.


Xtext 2.8.1
Re: problems with global scoping [message #1699251 is a reply to message #1699239] Tue, 23 June 2015 04:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

your example works fine. did you do any customizations so far?!?
if you use the open model element dialog, can you see the elements.
is your model project a java project or not.
if it is: are the models in a source folder?


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

[Updated on: Tue, 23 June 2015 04:39]

Report message to a moderator

Re: problems with global scoping [message #1699264 is a reply to message #1699251] Tue, 23 June 2015 07:12 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
Thanks for the answer
I downloaded a new luna with the xtext 2.8.3 installed (just to be sure) and created a new xtext-project as described.

1.) no I did not do any customization
2.) If you mean the Outline dialog. Yes I can see all the elements in the tree.
3.) Yes my model project is a Java Project
4.) Yes the models are in the src folder in the test package. (To make sure I create a Java-class in that package and it worked like expected)

The message is only shown in the editor window, but not in the tree of the Package Explorer.

Any other clue? Where can I start debugging?


Xtext 2.8.1
Re: problems with global scoping [message #1699268 is a reply to message #1699264] Tue, 23 June 2015 07:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
No i mean the Open Model Element Dialog (Navigate Menu) It Shows the Content of the index

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

[Updated on: Tue, 23 June 2015 07:46]

Report message to a moderator

Re: problems with global scoping [message #1699271 is a reply to message #1699268] Tue, 23 June 2015 08:07 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
Ok the Open Model Element Dialog is empty.

What may be the reason?


Xtext 2.8.1
Re: problems with global scoping [message #1699278 is a reply to message #1699271] Tue, 23 June 2015 08:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Sure the project has Xtext Nature and you have build automatically on?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with global scoping [message #1699281 is a reply to message #1699278] Tue, 23 June 2015 08:42 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
These are the defaults. I did not change them and double checked now.

Xtext 2.8.1
Re: problems with global scoping [message #1699293 is a reply to message #1699281] Tue, 23 June 2015 09:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
can you share your example project containing the model files

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with global scoping [message #1699294 is a reply to message #1699293] Tue, 23 June 2015 09:32 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
I zip-ed the workspace containing the dsl and the eclipse-test project.

Maybe this helps.
Thanks.
  • Attachment: workspace.zip
    (Size: 21.20MB, Downloaded 112 times)


Xtext 2.8.1
Re: problems with global scoping [message #1699297 is a reply to message #1699294] Tue, 23 June 2015 09:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
your file extension is mydsl and not myDsl

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: problems with global scoping [message #1699300 is a reply to message #1699297] Tue, 23 June 2015 09:55 Go to previous message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
Thank's a lot. And sorry for the stupid mistake, but I would have never figured that one out. Embarrassed

Xtext 2.8.1
Previous Topic:New Formatting API 2: Indentation of EObject
Next Topic:EcoreUtil.equals is not returning the value properly
Goto Forum:
  


Current Time: Tue Mar 19 06:21:05 GMT 2024

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

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

Back to the top