Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Java model package name
Java model package name [message #1807392] Wed, 29 May 2019 07:52 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
I have an application that develops around an ecore model, so I will have plugins

com.acme.myapp
com.acme.myapp.ui
...
and also the ecore model plugin. I want the generated interfaces go to package:

com.acme.myapp.model

The only possible way that I know to get this result is: The ecore package name must be 'model', and the genmodel base package changes to com.acme.myapp. I don't really like to name the ecore package 'model', just to have it generate into the correct package. Is there any better way?

Felix
Re: Java model package name [message #1807408 is a reply to message #1807392] Wed, 29 May 2019 09:34 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The GenModel options, in particular the package suffixes patterns, give you quite a bit of naming flexibility, but perhaps not what you need.

If you step back and examine your question, you seem to ask why you you are called Felix when your name is Felix? Using different Ecore/Java packages names risks causing more confusion in the long term than you may be saving in the short term.

Regards

Ed Willink
Re: Java model package name [message #1807409 is a reply to message #1807408] Wed, 29 May 2019 10:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
In particular these options are on the GenPackage so you might specify "model.impl", "model", and "model", and "model.util" for the Implementation, Interface, Metadata, and Utility properties of the GenPackage. You can accomplish pretty much anything via these "Package Suffixes". I don't see any real problem with this being confusing in some way. The relation between an EPackage name and some Java package qualified names is rather arbitrary.

What I do find a bit confusing is when I hit Ctrl-Shift-T that I find two EcorePackages when I have OCL in my target platform. So better you have a FelixPackage and not a ModelPackage that will be confused with other ModelPackages, though Model doesn't really narrow down what kind of model it actually is so hopefully no one uses that name.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Java model package name [message #1807410 is a reply to message #1807409] Wed, 29 May 2019 10:29 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 392
Registered: December 2015
Senior Member
Ed, I had tried these options before, but I missed to set the complementing base package. Now it's all good. Cool. Two EcorePackage proposals are definitely mildly infuriating. How can they!? :P
Re: Java model package name [message #1807419 is a reply to message #1807410] Wed, 29 May 2019 14:06 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

One is org.eclipse.emf.ecore.EcorePackage
The other is org.eclipse.ocl.ecore.EcorePackage

The latter is for the Classic Ecore binding. That package name was a free choice so it is very unfortunate that we are stuck with the conflict, but too late to change now. It does of course help to test that EMF JET templates qualify names appropriately.

More realistically, any class name can be ambiguous. I am sure everyone has fallen over java.awt.List and of course if you are interested in the Type class you may have 15 choices. EMF itself could perhaps have chosen EResource rather than doubling up on org.eclipse.core.internal.resources.Resource.

Regards

Ed Willink
Previous Topic:DnD doesn't work in editor, under Wayland (Linux)
Next Topic:How to get the ItemProvider of a element
Goto Forum:
  


Current Time: Sat Apr 20 02:45:26 GMT 2024

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

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

Back to the top