Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » "Hidden" model elements
"Hidden" model elements [message #639490] Tue, 16 November 2010 17:58 Go to next message
Fernando Gonz is currently offline Fernando GonzFriend
Messages: 13
Registered: October 2010
Junior Member
Hi all,

I would like to know what's the best way to have "hidden" or "default" elements in a model. With "hidden" I mean elements that are not included by the user in the model but that are present for the scope provider, linking service, etc. I don't know if it's clear. An example of such "hidden" element could be the "java.lang.*" import in java.

I can only think of crazy ideas and I have the feeling that this is quite common and has a straightforward solution. Am I wrong?

Thanks in advance for any help,
Fernando.
Re: "Hidden" model elements [message #639527 is a reply to message #639490] Tue, 16 November 2010 19:21 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Fernando,

the easiest way to achieve implicit imports semantics is to override
ImportedNamespaceAwareLocalScopeProvider.getImportedNamespac eResolvers(EObject)
and add the import there.

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

Am 16.11.10 18:58, schrieb Fernando Gonzalez:
> Hi all,
>
> I would like to know what's the best way to have "hidden" or "default"
> elements in a model. With "hidden" I mean elements that are not included
> by the user in the model but that are present for the scope provider,
> linking service, etc. I don't know if it's clear. An example of such
> "hidden" element could be the "java.lang.*" import in java.
>
> I can only think of crazy ideas and I have the feeling that this is
> quite common and has a straightforward solution. Am I wrong?
>
> Thanks in advance for any help,
> Fernando.
Re: "Hidden" model elements [message #639608 is a reply to message #639527] Wed, 17 November 2010 07:55 Go to previous message
Fernando Gonz is currently offline Fernando GonzFriend
Messages: 13
Registered: October 2010
Junior Member
Hi Sebastian, thanks for your answer.

I've found no getImportedNamespaceResolvers(EObject) in ImportedNamespaceAwareLocalScopeProvider. Could it be that you mean getImportNormalizer(EObject context)? Indeed I successfully added some ImportNormalizers to achieve a similar goal.

In my concrete case it's not only about imports but also about some data structures my model deals with. I have too possibilities:
1) There are some instances of these structures that are not defined in the user model but in the user interface, and it should be possible to refer to them with no declaration in the user model.
2) I have an array-like structure with no attributes but I want to be able to refer to a "length" attribute.

I can't try (1) yet, but I've been able to create the "length" attribute explained in (2). It seems to work well so far.

What I understand is that, as a general rule, any hidden model element can be added in the scope provider. Please, correct me if I'm wrong.

Concerning (1), I would like to include those structures in a separate resource (I cannot have more than one namespace in a model) in order to avoid name collisions. Is global scope provider the place to add a "hidden" resource?

BTW, is it possible to create a Resource in memory? In my test cases I'm using a file in /tmp for each small model I'm testing...

Best regards,
Fernando.
Previous Topic:[SOLVED] How to access to "com.google.inject.Injector.Injector" from JavaValidator
Next Topic:[CDO] Using a Resource (URI) direct for M2M Transformation with ATL
Goto Forum:
  


Current Time: Wed Apr 24 15:10:19 GMT 2024

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

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

Back to the top