Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with the import statement in my grammar(Import statement does not refer to namespace URIs in runtime workbench)
Problems with the import statement in my grammar [message #654498] Wed, 16 February 2011 03:56 Go to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
Hi,
I was trying to create a grammar using xtext. I was doin this by reading the xText user guide :- http://www.eclipse.org/Xtext/documentation/latest/xtext.html

In my grammar, i have defined an "import" statement which has to take namespace uris of ecore models. I have defined a scope provider MyScopeProvider which extends AbstractDeclarativeScopeProvider.

The problem i am facing is that, for giving the namespace uri of an ecore file in the import statement, the project containing the ecore file as well as the source folder should be either in the design time workbench or must be installed using update site.
If i put the whole project with sources, ecore file, genmodel etc in the runtime workbench, the import statement doesn't work and gives an error saying unable to resolve.

Is there anything extra that i will have to do in my scoping to include runtime workspace also, so that imports can be recognized??


Regards,
Animesh
Re: Problems with the import statement in my grammar [message #654706 is a reply to message #654498] Wed, 16 February 2011 18:39 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

if I understand your problem correctly, you'll have to do what the documentation says. The ecore is known via its namespace URI only if it is "deployed", i.e. has been registered, e.g. via an extension point of a plugin.

This is why it is recommended to use the namespace uri only if you can be sure that this is the case. Otherwise you could use a platform:/resource uri to a ecore file in your current workspace.

Alex
Re: Problems with the import statement in my grammar [message #654772 is a reply to message #654706] Thu, 17 February 2011 03:37 Go to previous messageGo to next message
Animesh Kumar is currently offline Animesh KumarFriend
Messages: 79
Registered: September 2010
Location: Bangalore
Member
Hi Alexander,
Thanks for the reply.

But the problem is that, I don't want to use the ECore file directly (using the platform:/resource).

Is there any way i can use namespace uris of the EPackages in the ECore files which are there in my runtime workbench?

The Problem Statement is :-
I have created a grammar for my DSL. As in Java, my DSL can have import statements. So When i run my generated DSL and in the editor for the DSL, i give namespace uris for EPackages, in the import statement of my DSL.

The Problem is that, my DSL recognizes namespace URIs of only those EPackages whose Ecore file and Source Folder in there in Design Time Work Bench ( Where I had created my grammar) or the project ( The one containing Ecore file and Sources) must be already installed via update site. But if i keep all the sources and the Ecore file in runtime workbench, the DSL gives an error saying couldnot resolve. Why is it so?

I don't know where i went wrong. The ScopeProvider which I am using extends AbstractDeclarativeScopeProvider


Regards,
Animesh
Re: Problems with the import statement in my grammar [message #654782 is a reply to message #654772] Thu, 17 February 2011 07:36 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

again. Eclips knows the nsURI of an ecore file only if it has been registered, which is not necessarily the case for ecore files lying around in your workspace. You could as well be asking why eclipse does not automatically run any java class containing a main method.

So, register the ecore files or allow a different URI.

Alex
Previous Topic:Parsing EOF in XText 2.0?
Next Topic:Scope provider and content assist out of sync?
Goto Forum:
  


Current Time: Fri Apr 26 15:09:26 GMT 2024

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

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

Back to the top