Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » problem combining importURI and importNamespace
problem combining importURI and importNamespace [message #759101] Sat, 26 November 2011 11:29 Go to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
Hi,

I'm trying to let the user define explicitly which files should be used by an include keyword.
Within those files are namespaces defined, the user should be able to import namespaces from the files that are defined.

in other words, how to disable the cross reference between files for namespaces, unless it is stated by the importURI?

I have also a second question which is a bit harder,
The scope of the namespaces should be in a chronological order,

for example 2 namespaces are already defined, A B :
namespace D {
  using namespace A
  // namespace A available
  using namespace B
  // namespace A and B available
}

Is this order of scoping possible in Xtext?

Regards,
Phil

[Updated on: Sun, 11 December 2011 17:03]

Report message to a moderator

Re: problem combining importURI and importNamespace [message #759123 is a reply to message #759101] Sat, 26 November 2011 15:16 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
The ImportURIScopingFragment (or rather: the scope provider implementations it binds) provides you with the automagical behavior which you want to forbid. So, you have to implement a custom scope provider (covered in the Reference Manual) which limits the scoping to what's intended. Luckily, you can have much of the magical functionality for free by having Guice inject the implementations and filtering the results from that. Also, Xtext's IScope API is hierarchical so you can have a "Hanoi tower" of scopes with the higher levels shadowing the lower levels.

Re: problem combining importURI and importNamespace [message #763753 is a reply to message #759123] Sat, 10 December 2011 13:41 Go to previous messageGo to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
Hi Meinte Boersma, thank you for your help. Also your blog explained a couple of things for me Wink

Regards,
Phil

[Updated on: Sun, 11 December 2011 09:39]

Report message to a moderator

Re: problem combining importURI and importNamespace [message #764092 is a reply to message #763753] Sun, 11 December 2011 10:22 Go to previous message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
Hi,

I got it working, but it looks like there is a better way then how I implemented it.
Edit: never mind, it's ok now

Phil

[Updated on: Mon, 12 December 2011 19:24]

Report message to a moderator

Previous Topic:Scope Provider: Context
Next Topic:Strange errors when using several model files
Goto Forum:
  


Current Time: Sun Mar 29 22:51:27 GMT 2020

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

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

Back to the top