Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtext2.0] ImportedNamespace problems
[xtext2.0] ImportedNamespace problems [message #696162] Wed, 13 July 2011 11:58 Go to next message
Arjan  van der Meer is currently offline Arjan van der MeerFriend
Messages: 8
Registered: February 2010
Junior Member
Hello,

I'm working on a language where I want to refer to Ecore metamodels. I tried to implement this by using the default scoping.ImportNamespacesScopingFragment and exporting.QualifiedNamesFragment. In Xtext 1.1, this used to work to some extend, in that it simply imported everything it could find, including the metamodel of the language itself.

In Xtext 2.0, it appears not to work anymore. It still looks like it ignores ImportedNamespace attributes, but now it looks like nothing is imported. The problem is that I don't know what I am importing, if anything. How do I know if the ImportedNamespace attributes are actually working? Is there some way I can see what is in scope at a certain point in my file?
Re: [xtext2.0] ImportedNamespace problems [message #696305 is a reply to message #696162] Wed, 13 July 2011 16:38 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
How about setting a breakpoint in the
org.eclipse.xtext.scoping.impl.ImportNormalizer.deresolve(QualifiedName)
or somewhere in the
org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider
?

Am 13.07.11 13:58, schrieb Arjan van der Meer:
> Hello,
>
> I'm working on a language where I want to refer to Ecore metamodels. I
> tried to implement this by using the default
> scoping.ImportNamespacesScopingFragment and
> exporting.QualifiedNamesFragment. In Xtext 1.1, this used to work to
> some extend, in that it simply imported everything it could find,
> including the metamodel of the language itself.
>
> In Xtext 2.0, it appears not to work anymore. It still looks like it
> ignores ImportedNamespace attributes, but now it looks like nothing is
> imported. The problem is that I don't know what I am importing, if
> anything. How do I know if the ImportedNamespace attributes are actually
> working? Is there some way I can see what is in scope at a certain point
> in my file?


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: [xtext2.0] ImportedNamespace problems [message #696652 is a reply to message #696305] Thu, 14 July 2011 13:51 Go to previous messageGo to next message
Arjan  van der Meer is currently offline Arjan van der MeerFriend
Messages: 8
Registered: February 2010
Junior Member
I just tried that, but that didn't seem to work. I guess I have to recompile the library for it to have effect, right? Is there an easier way to do it?
Re: [xtext2.0] ImportedNamespace problems [message #696752 is a reply to message #696652] Thu, 14 July 2011 18:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

did you have a look into global scope with Crtl + Shift + F3 to see which objects are in the index?

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [xtext2.0] ImportedNamespace problems [message #697925 is a reply to message #696752] Mon, 18 July 2011 11:27 Go to previous messageGo to next message
Arjan  van der Meer is currently offline Arjan van der MeerFriend
Messages: 8
Registered: February 2010
Junior Member
Hi,

Using that, I can see that the metamodel I want want to import is in the global scope when using the old XText, and not when using XText 2.0. I tried generating a plugin from the metamodel and loading it to see if that made a difference, but it still doesn't show up. How can I add the model to the index?
Re: [xtext2.0] ImportedNamespace problems [message #697932 is a reply to message #697925] Mon, 18 July 2011 11:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

am not quite sure what you are doing:
you have a xyz metamodel and .xyz model files (created with the xyz editor)???
and want to add these to the index: then same as Xtext 1.0.x:
Implement a ResourceServiceProvider

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [xtext2.0] ImportedNamespace problems [message #698471 is a reply to message #697932] Tue, 19 July 2011 14:31 Go to previous messageGo to next message
Arjan  van der Meer is currently offline Arjan van der MeerFriend
Messages: 8
Registered: February 2010
Junior Member
Hi,

I have an ecore metamodel (as in, a .ecore file, based on the ecore metametamodel). I want to use the metamodel as if it were a normal model file: i.e. I want to use things like [ecore::EClass] in my XText grammar to refer to elements of an imported metamodel.
At the moment, I have a grammar with importedNamespace attributes to define the imports, and references to various ecore elements. Using XText 2.0, the result is that local references work, but nothing appears to be imported at all. It did work to some extend in XText 1.1, but due to the limited debugging options, I'm not sure what exactly is going on. That's what I'm trying to find out.
Re: [xtext2.0] ImportedNamespace problems [message #698500 is a reply to message #698471] Tue, 19 July 2011 15:04 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

as I said before: you have (and hand in xtext 1.0.x) write a IResourceServiceProvider for this. I blogged about writing one for .uml files here:
http://christiandietrich.wordpress.com/2011/07/17/xtext-2-0-and-uml/

But if you want to refer to ecore::EClasses this should work out of the box since Xtext Ships with an ResourceServiceProvider for ecore Files.

Can you share a example grammar? / Write more about you project setup at runtime?

~Christian


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

[Updated on: Tue, 19 July 2011 21:40]

Report message to a moderator

Previous Topic:Unit Testing
Next Topic:Diagnosing a performance issue
Goto Forum:
  


Current Time: Wed Apr 24 15:17:40 GMT 2024

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

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

Back to the top