Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Scoping query(Scoping query)
icon5.gif  Scoping query [message #1696587] Wed, 27 May 2015 11:41 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi All,

My model looks something like this:

name MyClass
import MyClass2

Entity entity1 {
.... some definition

}

ImportAndExport IandE {

imports [entity2]
exports [entity1]

}




My root node (namespace ) will be written at the top.

Apart from that I have defined two more rules, one for Entity and one more for ImportAndExport .


When I want to refer elements from other files then we either import namespace at the top and write element names directly (i.e. entity2 referred directly here) or we import it with namespace, something like MyClass2.entity2.

Now My requirement is I want to add scoping to the ImportAndExport but not the namespace.

So say that , entity2 is exported in:

ImportAndExport IandE2 {

imports [entity3]
exports [entity2]

}


And hence whenever I refer it in other files I want to refer it as IandE2.entity2 but not MyClass2.entity2.

How can I achieve this ?


Thanks for any help Smile


Arshad
Re: Scoping query [message #1696666 is a reply to message #1696587] Wed, 27 May 2015 18:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13888
Registered: July 2009
Senior Member
is this exporting thing a local (same file as declaration) thing or a global one?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Scoping query [message #1696669 is a reply to message #1696666] Wed, 27 May 2015 18:30 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,

Thanks for your reply.
I actually want it for global. (It may or may not be in the same file).



Thanks and regards,
Arshad


Arshad
Re: Scoping query [message #1696670 is a reply to message #1696669] Wed, 27 May 2015 18:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13888
Registered: July 2009
Senior Member
Hi,

if you want to change how stuff is indexed you have to adapt DefaultResourceDescriptionStrategy (you may need to use the node model to find out the cross ref text). for local refs you have to adapt ImportedNamespaceAwareLocalScopeProvider


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 27 May 2015 18:38]

Report message to a moderator

icon5.gif  Re: Scoping query [message #1696693 is a reply to message #1696670] Thu, 28 May 2015 04:17 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
HI Christian,

Thanks a lot for the info.

Can we create 2 EObjectDescriptions for one EObject ?

I mean to say, In my previous example, I should be able to refer entity2 as MyClass2.entity2 and IandE2.entity2 as well.

Is it the usual case ?



Regards,
Arshad


Arshad
Re: Scoping query [message #1696694 is a reply to message #1696693] Thu, 28 May 2015 05:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13888
Registered: July 2009
Senior Member
Yes you can create as many as you want

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
icon14.gif  Re: Scoping query [message #1696697 is a reply to message #1696694] Thu, 28 May 2015 05:47 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Thanks Christian,

I will try to do it.


Regards,
Arshad


Arshad
icon14.gif  Re: Scoping query [message #1697198 is a reply to message #1696694] Tue, 02 June 2015 11:34 Go to previous message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,

I created new EObjectDescription for it and it works quite well.
Thanks for your suggestion Smile



Regards,
Arshad


Arshad
Previous Topic:Parse XExpressions
Next Topic:Xtext & Xtend 2.8.3 released
Goto Forum:
  


Current Time: Thu Apr 22 15:30:27 GMT 2021

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

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

Back to the top