Why does EAnnoptation initialization code not set the annotation contents ? [message #899859] |
Thu, 02 August 2012 12:03  |
Eclipse User |
|
|
|
I created an annotation with content objects.
My attached Model mypackage.ecore contains 2 instances of class State
inside the "States" annotation for MyRootObject eClass,
but I don't see any attempts in the templates to reflect this in the
generated
MypackagePackageImpl.java which contains the default generated code:
/**
* Initializes the annotations for <b>States</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createStatesAnnotations() {
String source = "States";
addAnnotation(myRootObjectEClass, source, new String[] {});
}
the latter call addAnnotation(myRootObjectEClass, source, new
String[] {});
does NOT even try to set the annotation contents.
Why?
Regards, Philipp
|
|
|
Re: Why does EAnnoptation initialization code not set the annotation contents ? [message #899894 is a reply to message #899859] |
Thu, 02 August 2012 13:28  |
Eclipse User |
|
|
|
Philipp,
Comments below.
On 02/08/2012 6:03 PM, Philipp W. Kutter | Montages AG wrote:
> I created an annotation with content objects.
>
> My attached Model mypackage.ecore contains 2 instances of class State
> inside the "States" annotation for MyRootObject eClass,
> but I don't see any attempts in the templates to reflect this in the
> generated
No. Even to try, we'd need the GenModel for the eClass() of the
instance objects...
> MypackagePackageImpl.java which contains the default generated code:
>
> /**
> * Initializes the annotations for <b>States</b>.
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> protected void createStatesAnnotations() {
> String source = "States";
> addAnnotation(myRootObjectEClass, source, new String[] {});
> }
>
> the latter call addAnnotation(myRootObjectEClass, source, new
> String[] {});
>
> does NOT even try to set the annotation contents.
>
> Why?
It's not a trivial problem. You could try setting the GenPackage to use
Initialize by Loading; the contain objects should be serialized and if
the generated model is available during loading, they should be resurrected.
>
> Regards, Philipp
|
|
|
Powered by
FUDForum. Page generated in 0.03518 seconds