Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to implicitly import an XMI resource ?
How to implicitly import an XMI resource ? [message #703447] Wed, 27 July 2011 15:25 Go to next message
Julien Bigot is currently offline Julien BigotFriend
Messages: 26
Registered: July 2009
Junior Member
Hi,

I have created my metamodel with primitive types (int, string, etc.) and constructed types (struct, tuple, array, etc.)
The choice I've made is to have a single PrimitiveType (meta)class and to define my primitive types as instances of this class. currently I store them in an XMI file.

I have also developed a parser for a language associated with this metamodel. But obviously, without proper support, the XMI file isn't known to the parser while this should be transparent to the users. So I am wondering:

What's the proper way to have my XMI file implicitly included in any user source ?

Regards,
Julien
Re: How to implicitly import an XMI resource ? [message #703461 is a reply to message #703447] Wed, 27 July 2011 15:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13614
Registered: July 2009
Senior Member
Hi,

the keyword is ResourceServiceProvider, but it would be helpful
if you generate an editor for the metamodel too,
so that the xmi files have an .xyz extension and not a .xmi

~Christian


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: How to implicitly import an XMI resource ? [message #703472 is a reply to message #703461] Wed, 27 July 2011 15:52 Go to previous messageGo to next message
Julien Bigot is currently offline Julien BigotFriend
Messages: 26
Registered: July 2009
Junior Member
Ok, thank you for the info!

Regarding the generation of a metamodel editor, I didn't do it.
Instead, I have set the Model.FileExtension and defined Model.ResourceType to "XMI". It seems to me this is enough to allow loading the model from a file with an extension. I don't think I need to generate an editor for a single file that's not expected to need any change.
Re: How to implicitly import an XMI resource ? [message #703473 is a reply to message #703472] Wed, 27 July 2011 15:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13614
Registered: July 2009
Senior Member
Hi,

just as some background info: the resourceserviceprovider is bound to the file extensions so .xmi may be a bad idea

~Christian


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: How to implicitly import an XMI resource ? [message #703480 is a reply to message #703473] Wed, 27 July 2011 16:01 Go to previous messageGo to next message
Julien Bigot is currently offline Julien BigotFriend
Messages: 26
Registered: July 2009
Junior Member
I guess I wasn't specific enough.
I did set the ResourceType to "XMI", but the FileExtension to something else ("xhla" in my case.)
If I understand correctly, this actually means that the content of the file will be XMI but that the expected (and thus loaded) extension is .xhla
Re: How to implicitly import an XMI resource ? [message #703486 is a reply to message #703480] Wed, 27 July 2011 16:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13614
Registered: July 2009
Senior Member
Hi,

have never tried this but it should work.

~Christian


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
Previous Topic:?how to mix strategies of global scoping?
Next Topic:How can I run xtext from a webservice?
Goto Forum:
  


Current Time: Tue Sep 29 22:56:03 GMT 2020

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

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

Back to the top