Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Package.getESuperPackage() returns null
Package.getESuperPackage() returns null [message #1117256] Thu, 26 September 2013 08:48 Go to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello,

I have two EMF packages: packageA is extending packageB.
In my ecore editor, I have used 'Load Resource' to load packageB, in order to use its elements in packageA.

I would think that I could use packageA.getESuperPackage() in order to obtain packageB.
But instead I get null back.

It is easily fixed by manually overriding the method and returning the correct package, but I would like to use the proper way.

So, do I need to configure a certain property in my ecore or genmodel files to activate this behavior? Or is there something else that I am missing?

I use EMF 2.9

Thanks,
Maarten
Re: Package.getESuperPackage() returns null [message #1117262 is a reply to message #1117256] Thu, 26 September 2013 08:55 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Maarten,

AFAIK in Ecore, getESuperPackage() returns the container of an EPackage.

Cheers,
Dimitris
Re: Package.getESuperPackage() returns null [message #1117269 is a reply to message #1117262] Thu, 26 September 2013 09:03 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Thanks for your reply. (It seems that I posted in the wrong forum, should have used EMF forum... Embarrassed )

Hm... I would have thought it would return the super package in terms of the package that is used as a base for this package...

I require this to validate my model with both the validation rules of the main package and the packages that are used to construct this package.
As both set of validation rules check for different problems.

Currently, I have added custom methods to the generated model code to get hold of the 'super package', but I was wondering whether there is a supported/proper way to get hold of this information.

Thanks,
Maarten
Re: Package.getESuperPackage() returns null [message #1117273 is a reply to message #1117256] Thu, 26 September 2013 09:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Maarten,

Comments below.

On 26/09/2013 10:48 AM, Maarten Bezemer wrote:
> Hello,
>
> I have two EMF packages: packageA is extending packageB.
Packages don't have a relation that involves extending. Perhaps you
mean packageA has EClasses that extend the EClasses in packageB, but
that's a statement about the classes not the packages.
> In my ecore editor, I have used 'Load Resource' to load packageB, in
> order to use its elements in packageA.
>
> I would think that I could use packageA.getESuperPackage() in order to
> obtain packageB.
No.
> But instead I get null back.
If packageA don't contain packageB, that's expected.
>
> It is easily fixed by manually overriding the method and returning the
> correct package, but I would like to use the proper way.
That sounds like a bad idea.
>
> So, do I need to configure a certain property in my ecore or genmodel
> files to activate this behavior?
No, your expectations are are little off.
> Or is there something else that I am missing?
Why do you think you need this?
>
> I use EMF 2.9
>
> Thanks,
> Maarten


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Package.getESuperPackage() returns null [message #1117281 is a reply to message #1117273] Thu, 26 September 2013 09:17 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello Ed,

As I explained to Dimitris, my expectations of ESuperPackage were wrong.

I am looking for the packages that are used by packageA to get the corresponding Epsilon EVL validation rules for these packages. In order to have a (more) complete validation of my model.

Do you know a way to get hold of this information?

Thanks,
Maarten

[Updated on: Thu, 26 September 2013 09:17]

Report message to a moderator

Re: Package.getESuperPackage() returns null [message #1117842 is a reply to message #1117281] Thu, 26 September 2013 21:33 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Maarten,

One way to do this would be to get all the EClasses in packageA, and then collect the EPackages that their eSuperTypes() are contained in.

Cheers,
Dimitris
Re: Package.getESuperPackage() returns null [message #1121103 is a reply to message #1117842] Mon, 30 September 2013 09:18 Go to previous message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hello Dimitris,

That is a nice thought/idea..!
It does not require modification to the generated package classes... (which I have now)

But, it does result in some overhead, as there are quite some EClasses defined...

I just realised that the *.ecore files also contain the namespaces of the used packages, if I can grab this information somehow it is easier to get hold of all 'super-packages'.

I guess I'll think about it some more.
Thanks for your suggestion!

Cheers,
Maarten
Previous Topic:The package is needed but is not accessible from the generator model
Next Topic:EObjectValidator.validate() is called multiple times for models that are based on several packages
Goto Forum:
  


Current Time: Thu Apr 25 11:03:40 GMT 2024

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

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

Back to the top