Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Generating code for packages that only contain other packages
Generating code for packages that only contain other packages [message #1391795] Tue, 01 July 2014 12:21 Go to next message
Matthias Jurisch is currently offline Matthias JurischFriend
Messages: 3
Registered: September 2013
Junior Member
Hello,

I am working on a ecore model that has a package structure similiar to this:

rootp
- packA
- packB


The package rootp contains no classes, only the two packages packA and packB. When generating code from this model, no EPackage is created for rootp, only for the packages packA and packB.

This can be fixed by adding a class to the package rootp, but shouldn't there be a generated EPackage for rootp anyway? Is there an option to allow generating code for the package rootp?

I have attached an EMF project for demonstration of the problem.

Thanks,
Matthias
Re: Generating code for packages that only contain other packages [message #1391842 is a reply to message #1391795] Tue, 01 July 2014 13:44 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Matthias,

Nested packages are evil, and no, we generate nothing for an empty package:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=142856

Adding a "dummy" EDataType will force it to generate.

Is there is a compelling reason to have generated code that's not
capable of doing anything useful? It's hard to imagine...


On 01/07/2014 2:21 PM, Matthias Jurisch wrote:
> Hello,
>
> I am working on a ecore model that has a package structure similiar to this:
>
>
> rootp
> - packA
> - packB
>
>
> The package rootp contains no classes, only the two packages packA and packB. When generating code from this model, no EPackage is created for rootp, only for the packages packA and packB.
>
> This can be fixed by adding a class to the package rootp, but shouldn't there be a generated EPackage for rootp anyway? Is there an option to allow generating code for the package rootp?
>
> I have attached an EMF project for demonstration of the problem.
>
> Thanks,
> Matthias
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Generating code for packages that only contain other packages [message #1391897 is a reply to message #1391842] Tue, 01 July 2014 15:15 Go to previous messageGo to next message
Matthias Jurisch is currently offline Matthias JurischFriend
Messages: 3
Registered: September 2013
Junior Member
Hello Ed,

thanks for your reply. I need the generated code only for registering the rootp package for model transformation with qvt operational. The problem I have here is that the package structure is different when using dynamic and static ecore, since when using static ecore the "empty" packages do not exist. So when I try to transform models created with static ecore the transformation does not compile.

Greetings, Matthias
Re: Generating code for packages that only contain other packages [message #1391968 is a reply to message #1391897] Tue, 01 July 2014 17:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Matthias,

You're best to avoid subpackages entirely and if you can't avoid that, a
dummy EDataType will do the trick.

On 01/07/2014 5:15 PM, Matthias Jurisch wrote:
> Hello Ed,
>
> thanks for your reply. I need the generated code only for registering
> the rootp package for model transformation with qvt operational. The
> problem I have here is that the package structure is different when
> using dynamic and static ecore, since when using static ecore the
> "empty" packages do not exist. So when I try to transform models
> created with static ecore the transformation does not compile.
> Greetings, Matthias


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:ECP with generics
Next Topic:[code-gen] How to make EMF to add extra comments to the generated code
Goto Forum:
  


Current Time: Thu Mar 28 18:35:54 GMT 2024

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

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

Back to the top