Skip to main content



      Home
Home » Modeling » TMF (Xtext) » problem combining importURI and importNamespace
problem combining importURI and importNamespace [message #759101] Sat, 26 November 2011 06:29 Go to next message
Eclipse UserFriend
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 12:03] by Moderator

Re: problem combining importURI and importNamespace [message #759123 is a reply to message #759101] Sat, 26 November 2011 10:16 Go to previous messageGo to next message
Eclipse UserFriend
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 08:41 Go to previous messageGo to next message
Eclipse UserFriend
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 04:39] by Moderator

Re: problem combining importURI and importNamespace [message #764092 is a reply to message #763753] Sun, 11 December 2011 05:22 Go to previous message
Eclipse UserFriend
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 14:24] by Moderator

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


Current Time: Wed Jul 23 21:27:54 EDT 2025

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

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

Back to the top