Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Why does EAnnoptation initialization code not set the annotation contents ?
Why does EAnnoptation initialization code not set the annotation contents ? [message #899859] Thu, 02 August 2012 16:03 Go to next message
Philipp W. Kutter is currently offline Philipp W. KutterFriend
Messages: 305
Registered: July 2009
Senior Member
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 17:28 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30372
Registered: July 2009
Senior Member
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
Previous Topic:Find ItemPropertyDescriptors by EClass instead of concrete instance
Next Topic:[CDO] Deprecated config elements in cdo-server.xml ?
Goto Forum:
  


Current Time: Sun Aug 25 12:10:00 GMT 2019

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

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

Back to the top