Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EAnnotation documentation
EAnnotation documentation [message #420777] Thu, 10 July 2008 11:40 Go to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi folks,
a Newbie Question.

the following Thread From 12 Mar 2007 conserning EAnnotation -"
It appears that we deliberately ignore these annotations (I don't remember
why) in the generated XyzPackageImpl because of *this *logic in
GenPackageImpl:


public List getAnnotationSources()
{
List result = new UniqueEList();
EPackage ePackage = getEcorePackage();
for (TreeIterator i = ePackage.eAllContents(); i.hasNext(); )
{
Object object = i.next();
if (object instanceof EPackage)
{
i.prune();
}
else if (object instanceof EAnnotation)
{
EAnnotation eAnnotation = (EAnnotation)object;
String source = eAnnotation.getSource();


// Ignore GenModel exceptions ones with a body for now.
//
if (source == null ||
*!source.equals(GenModelPackage.eNS_URI)* ||
eAnnotation.getDetails().containsKey("body"))
{
result.add(source);
}
}
}
return result;
}

As a workaround, if you change the GenPackage's Initialize by Loading
property to true, you should get these annotations.-"

Where to change the Loading property to True?

What i have is:

<xsd:complexType name="DnA">
<xsd:annotation>
<xsd:documentation>DOcElement.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="NiAndNan"
type="Nacl:ChromType"/>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:string" use="required"/>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:complexType>

Thank you!
Re: EAnnotation documentation [message #420780 is a reply to message #420777] Thu, 10 July 2008 11:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Sam,

Comments below.

Sam wrote:
> Hi folks,
> a Newbie Question.
>
> the following Thread From 12 Mar 2007 conserning EAnnotation -"
> It appears that we deliberately ignore these annotations (I don't
> remember why) in the generated XyzPackageImpl because of *this *logic
> in GenPackageImpl:
>
>
> public List getAnnotationSources()
> {
> List result = new UniqueEList();
> EPackage ePackage = getEcorePackage();
> for (TreeIterator i = ePackage.eAllContents(); i.hasNext(); )
> {
> Object object = i.next();
> if (object instanceof EPackage)
> {
> i.prune();
> }
> else if (object instanceof EAnnotation)
> {
> EAnnotation eAnnotation = (EAnnotation)object;
> String source = eAnnotation.getSource();
>
>
> // Ignore GenModel exceptions ones with a body for now.
> //
> if (source == null ||
> *!source.equals(GenModelPackage.eNS_URI)* ||
> eAnnotation.getDetails().containsKey("body"))
> {
> result.add(source);
> }
> }
> }
> return result;
> }
The logic doesn't look like that anymore.
>
> As a workaround, if you change the GenPackage's Initialize by Loading
> property to true, you should get these annotations.-"
>
> Where to change the Loading property to True?
On the GenPackage. :-P That's the second level of nesting in the
Generator. The GenModel is the root, and the GenPackages are the
immediate children.
>
> What i have is:
>
> <xsd:complexType name="DnA">
> <xsd:annotation>
> <xsd:documentation>DOcElement.</xsd:documentation>
> </xsd:annotation>
> <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="NiAndNan"
> type="Nacl:ChromType"/>
> </xsd:sequence>
> <xsd:attribute name="id" type="xsd:string" use="required"/>
> <xsd:attribute name="name" type="xsd:string" use="required"/>
> </xsd:complexType>
Note that there is a new GenModel property "Suppress GenModel
Annotations" that you can set to false.
>
> Thank you!
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EAnnotation documentation [message #420787 is a reply to message #420780] Thu, 10 July 2008 13:04 Go to previous messageGo to next message
Sam Julian is currently offline Sam JulianFriend
Messages: 29
Registered: July 2009
Junior Member
Hi Ed!

if I set Suppress GenModel Annotations to false, then I should be able to
get the "documentation" via EcoreUtil.getDocumentation(),or?
<xsd:annotation>
<xsd:documentation>DOcElement.</xsd:documentation>
</xsd:annotation>

Thank you
Re: EAnnotation documentation [message #420790 is a reply to message #420787] Thu, 10 July 2008 13:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Sam,

EcoreUtil.getDocumentation should return it.


sam wrote:
> Hi Ed!
>
> if I set Suppress GenModel Annotations to false, then I should be able
> to get the "documentation" via EcoreUtil.getDocumentation(),or?
> <xsd:annotation>
> <xsd:documentation>DOcElement.</xsd:documentation>
> </xsd:annotation>
>
> Thank you
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:synchronize 2 instances of the same model
Next Topic:ChangeRecorder
Goto Forum:
  


Current Time: Fri Apr 19 04:13:31 GMT 2024

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

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

Back to the top