Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Referencing another ecore model with package name changed
Referencing another ecore model with package name changed [message #518735] Thu, 04 March 2010 15:44 Go to next message
h1055071 is currently offline h1055071Friend
Messages: 335
Registered: July 2009
Senior Member
Hi,

I have simplified the following scenario to make it easier to explain...

I have an ECore model, "mymodel.ecore", contains one package, "mypackage".
In that package is an EClass, "MyClass".
In the .genmodel for the model I declare the base package to be
"com.somewhere".
Thus, the generated code resides in packages
"com.somewhere.mypackage" and "com.somewhere.mypackage.impl".

I have another ECore model, "another.ecore" wherein an EClass has a
EReference to the "MyClass" from "mymodel.ecore".
So I Load the "mymodel.ecore" Resource into the ECore editor and
reference it.
Fine.

However...when I generate the code for "another.ecore" from
"another.genmodel" the package name for "MyClass" is "mypackage.MyClass"
not "com.somewhere.mypackage.MyClass" and an error results.

Am I missing something?

(And many thanks for a wonderful modelling framework! :-) )

Phil
Re: Referencing another ecore model with package name changed [message #518737 is a reply to message #518735] Thu, 04 March 2010 20:41 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Phil,

Comments below.

Phillipus wrote:
> Hi,
>
> I have simplified the following scenario to make it easier to explain...
>
> I have an ECore model, "mymodel.ecore", contains one package,
> "mypackage".
> In that package is an EClass, "MyClass".
> In the .genmodel for the model I declare the base package to be
> "com.somewhere".
> Thus, the generated code resides in packages
> "com.somewhere.mypackage" and "com.somewhere.mypackage.impl".
>
> I have another ECore model, "another.ecore" wherein an EClass has a
> EReference to the "MyClass" from "mymodel.ecore".
> So I Load the "mymodel.ecore" Resource into the ECore editor and
> reference it.
> Fine.
>
> However...when I generate the code for "another.ecore" from
> "another.genmodel" the package name for "MyClass" is
> "mypackage.MyClass" not "com.somewhere.mypackage.MyClass" and an error
> results.
>
> Am I missing something?
Probably. When you created the GenModel for another.ecore, on the last
page of the wizard, did you locate the GenModel for mymodel.ecore and
select to reuse the GenPackage that already exists for mymodel.ecore
within that first GenModel? If not, you'll end up generating another
copy of that whole model and none of the settings you had before will be
there.
>
> (And many thanks for a wonderful modelling framework! :-) )
>
> Phil


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Referencing another ecore model with package name changed [message #518741 is a reply to message #518737] Thu, 04 March 2010 16:08 Go to previous message
h1055071 is currently offline h1055071Friend
Messages: 335
Registered: July 2009
Senior Member
On 04/03/2010 20:41, Ed Merks wrote:
> Phil,
>
> Comments below.
>
> Phillipus wrote:
>> Hi,
>>
>> I have simplified the following scenario to make it easier to explain...
>>
>> I have an ECore model, "mymodel.ecore", contains one package,
>> "mypackage".
>> In that package is an EClass, "MyClass".
>> In the .genmodel for the model I declare the base package to be
>> "com.somewhere".
>> Thus, the generated code resides in packages
>> "com.somewhere.mypackage" and "com.somewhere.mypackage.impl".
>>
>> I have another ECore model, "another.ecore" wherein an EClass has a
>> EReference to the "MyClass" from "mymodel.ecore".
>> So I Load the "mymodel.ecore" Resource into the ECore editor and
>> reference it.
>> Fine.
>>
>> However...when I generate the code for "another.ecore" from
>> "another.genmodel" the package name for "MyClass" is
>> "mypackage.MyClass" not "com.somewhere.mypackage.MyClass" and an error
>> results.
>>
>> Am I missing something?
> Probably. When you created the GenModel for another.ecore, on the last
> page of the wizard, did you locate the GenModel for mymodel.ecore and
> select to reuse the GenPackage that already exists for mymodel.ecore
> within that first GenModel? If not, you'll end up generating another
> copy of that whole model and none of the settings you had before will be
> there.
>>
>> (And many thanks for a wonderful modelling framework! :-) )
>>
>> Phil

Ed, thanks again for the fast response...

Yep, that was it. You nailed it! God, this EMF stuff is good!

Phil
Previous Topic:OPTION_DEFER_IDREF_RESOLUTION causes IOWrappedException
Next Topic:XML attributes and EMF editor
Goto Forum:
  


Current Time: Wed Apr 24 17:33:34 GMT 2024

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

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

Back to the top