|
|
|
|
Re: EAnnotation references between ecore models [message #903668 is a reply to message #903655] |
Fri, 24 August 2012 19:48 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
AJ,
Comments below.
On 24/08/2012 7:36 PM, AJ Ben wrote:
> Hi Ed#2,
>
> I tried your suggestion, but the new attribute is not populated with
> the data referenced in the other model.
Note that the generated EPackage will not generate the contents or
references features of an EAnnotation. If you set the GenPackage's
Initialize by Loading property to true, the generated package will
initialize by loading a serialized version of the Ecore model and that
will help preserve the containment and cross references of the EAnnotations.
> Maybe I missed something, here is what I did:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="stpStopDate"
> eType="ecore:EDataType
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDate">
> <eAnnotations
> references="platform:/resource/org.eclipse.test/models/fdpa.ecore#//SAPInit/stpStopDate"/>
I would have expected this to be a relative reference within the
workspace. I imagine it will be problematic to load this at runtime if
this model isn't available in the workspace at runtime.
An alternative approach is that you record in the annotations details
map a key with the value <nsURI>#<fragmentURI> of the model you expect
will be available at runtime. So you can use
EPackage.Registry.INSTANCE.getEPackage(<nsURI>).eResource().getEObject(<fragmentURI>)
to locate the feature you're referencing.
> </eStructuralFeatures>
>
> Thanks!
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03672 seconds