Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Registering EMF EPackage for Xtext
Registering EMF EPackage for Xtext [message #1024207] Tue, 26 March 2013 01:03 Go to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
Hi everyone,

This might be a repeated question but I really tried to do my best to find an answer before posting, didn't succeed as you can see.

I have created two EMF models using ecore, model2 referencing model1 and they both have a single genmodel. Now, I want to use these ecore models in my xtext grammar partially for the parts that are exactly matching with the grammar. I also generate another model as the AST for my DSL. As a result the generated AST has references to model1 and model2.

After much of search and reading, I found that it is recommended to use namesapceURI for referring to a model in xtext. I am doing so and the workflow runs correctly (after including genmodel and registering packages in standalone setup and setting the platform URI correctly). However, as you know xtext editor looks for registered packages to find the namespace URI, which in my case it fails to find. I find it very annoying and misleading to get errors in my editor and as a result package explorer, while everything is fine. My understanding is that I need to register my packages, but how I don't know. Do you have any link to tutorials on how to register the ecore models on your development instance of eclipse? Can you explain the steps here? I really couldn't find anything.

This is something that took 3 days of me and my colleagues! I am sure if you answer this you'll help many others.

Thanks in advance!
Roza
Re: Registering EMF EPackage for Xtext [message #1024263 is a reply to message #1024207] Tue, 26 March 2013 02:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Roza,

This sounds like an Xtext question best posted on the Xtext forum.

On 25/03/2013 9:03 PM, Roza Ghamari wrote:
> Hi everyone,
>
> This might be a repeated question but I really tried to do my best to
> find an answer before posting, didn't succeed as you can see.
>
> I have created two EMF models using ecore, model2 referencing model1
> and they both have a single genmodel. Now, I want to use these ecore
> models in my xtext grammar partially for the parts that are exactly
> matching with the grammar. I also generate another model as the AST
> for my DSL. As a result the generated AST has references to model1 and
> model2.
> After much of search and reading, I found that it is recommended to
> use namesapceURI for referring to a model in xtext. I am doing so and
> the workflow runs correctly (after including genmodel and registering
> packages in standalone setup and setting the platform URI correctly).
> However, as you know xtext editor looks for registered packages to
> find the namespace URI, which in my case it fails to find. I find it
> very annoying and misleading to get errors in my editor and as a
> result package explorer, while everything is fine. My understanding is
> that I need to register my packages, but how I don't know. Do you have
> any link to tutorials on how to register the ecore models on your
> development instance of eclipse? Can you explain the steps here? I
> really couldn't find anything.
> This is something that took 3 days of me and my colleagues! I am sure
> if you answer this you'll help many others.
>
> Thanks in advance!
> Roza


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Registering EMF EPackage for Xtext [message #1027234 is a reply to message #1024263] Tue, 26 March 2013 18:35 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member

Hi Ed,

That's right it sounds like an xtext question, but the real question I have is how to register an EMF model in my development eclipse environment regardless of where I want to refer to it. I can see it is even possible to reference to other registered EMF models in ecore editor.

Anyhow, if you still think this is an xtext question I can post it there.

Thanks
Re: Registering EMF EPackage for Xtext [message #1027301 is a reply to message #1027234] Tue, 26 March 2013 20:43 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33107
Registered: July 2009
Senior Member
Roza,

Each Ecore model (and even its GenModel which includes it's development
time Ecore version) are registered in the plugin.xml, but that helps
only in an environment that does extension point processing, which isn't
the case in an Xtext workflow (although it could use
org.eclipse.emf.ecore.plugin.EcorePlugin.ExtensionProcessor.process(ClassLoader)
(new in EMF 2.9) to do extension point processing in a stand alone
execution). So the question of how to register models for a workflow is
really an Xtext question.



On 26/03/2013 2:35 PM, Roza Ghamari wrote:
>
> Hi Ed,
>
> That's right it sounds like an xtext question, but the real question I
> have is how to register an EMF model in my development eclipse
> environment regardless of where I want to refer to it. I can see it is
> even possible to reference to other registered EMF models in ecore
> editor.
> Anyhow, if you still think this is an xtext question I can post it there.
>
> Thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Registering EMF EPackage for Xtext [message #1027408 is a reply to message #1027301] Tue, 26 March 2013 23:47 Go to previous messageGo to next message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
The problem is that I need processing of extension point before workflow (I know how to register in standalone setup, but that doesn't solve the problem with editor). Both ecore and xtext editor do not process the extension points. I exactly like to know if there is any way to process the extension point while developing my model or xtext grammar in Eclipse?

I'll post this message in xtext forum as well!

Thanks again.
Re: Registering EMF EPackage for Xtext [message #1027435 is a reply to message #1027408] Wed, 27 March 2013 00:50 Go to previous message
Roza Ghamari is currently offline Roza GhamariFriend
Messages: 82
Registered: January 2013
Member
Ok I found the solution for xtext. Adding xtext nature to the emf projects will do the registration
Previous Topic:Alphabetical Ordering of Elements in EMF Editor
Next Topic:Exporting multiple XSD schemas to ecore programmatically
Goto Forum:
  


Current Time: Tue Mar 19 04:02:36 GMT 2024

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

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

Back to the top