Skip to main content



      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 17:56 Go to next message
Eclipse UserFriend
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.
Re: problems with global scoping [message #1699251 is a reply to message #1699239] Tue, 23 June 2015 00:31 Go to previous messageGo to next message
Eclipse UserFriend
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?

[Updated on: Tue, 23 June 2015 00:39] by Moderator

Re: problems with global scoping [message #1699264 is a reply to message #1699251] Tue, 23 June 2015 03:12 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: problems with global scoping [message #1699268 is a reply to message #1699264] Tue, 23 June 2015 03:46 Go to previous messageGo to next message
Eclipse UserFriend
No i mean the Open Model Element Dialog (Navigate Menu) It Shows the Content of the index

[Updated on: Tue, 23 June 2015 03:46] by Moderator

Re: problems with global scoping [message #1699271 is a reply to message #1699268] Tue, 23 June 2015 04:07 Go to previous messageGo to next message
Eclipse UserFriend
Ok the Open Model Element Dialog is empty.

What may be the reason?
Re: problems with global scoping [message #1699278 is a reply to message #1699271] Tue, 23 June 2015 04:28 Go to previous messageGo to next message
Eclipse UserFriend
Sure the project has Xtext Nature and you have build automatically on?
Re: problems with global scoping [message #1699281 is a reply to message #1699278] Tue, 23 June 2015 04:42 Go to previous messageGo to next message
Eclipse UserFriend
These are the defaults. I did not change them and double checked now.
Re: problems with global scoping [message #1699293 is a reply to message #1699281] Tue, 23 June 2015 05:16 Go to previous messageGo to next message
Eclipse UserFriend
can you share your example project containing the model files
Re: problems with global scoping [message #1699294 is a reply to message #1699293] Tue, 23 June 2015 05:32 Go to previous messageGo to next message
Eclipse UserFriend
I zip-ed the workspace containing the dsl and the eclipse-test project.

Maybe this helps.
Thanks.
  • Attachment: workspace.zip
    (Size: 21.20MB, Downloaded 134 times)
Re: problems with global scoping [message #1699297 is a reply to message #1699294] Tue, 23 June 2015 05:43 Go to previous messageGo to next message
Eclipse UserFriend
your file extension is mydsl and not myDsl
Re: problems with global scoping [message #1699300 is a reply to message #1699297] Tue, 23 June 2015 05:55 Go to previous message
Eclipse UserFriend
Thank's a lot. And sorry for the stupid mistake, but I would have never figured that one out. Embarrassed
Previous Topic:New Formatting API 2: Indentation of EObject
Next Topic:EcoreUtil.equals is not returning the value properly
Goto Forum:
  


Current Time: Fri Jul 04 05:28:33 EDT 2025

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

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

Back to the top