Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Retrieving GenModel documentation for JavaDoc-style hovers
Retrieving GenModel documentation for JavaDoc-style hovers [message #674118] Wed, 25 May 2011 21:15 Go to next message
Nicolas Rouquette is currently offline Nicolas RouquetteFriend
Messages: 157
Registered: July 2009
Senior Member
When EMF loads a metamodel from the org.eclipse.emf.ecore.generated_package extension point, I get the impression that any GenModel/documentation annotation is ignored in the runtime representation of that metamodel.

For example, the org.eclipse.uml2.uml plugin registers this:

   <extension point="org.eclipse.emf.ecore.generated_package">
    <package 
       uri = "http://www.eclipse.org/uml2/3.0.0/UML" 
       class = "org.eclipse.uml2.uml.UMLPackage"
       genModel = "model/UML.genmodel" /> 
  </extension>


The model/UML.genmodel refers to the model/UML.ecore metamodel, which has documentation; e.g:

    <eOperations name="getNearestPackage" ordered="false" eType="#//Package">
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
        <details key="documentation" value="Retrieves the nearest package that owns (either directly or indirectly) this element, or the element itself (if it is a package)."/>
      </eAnnotations>
    </eOperations>


With the UML CodeGen extensions to the EMF CodeGen, this documentation goes to the generated UML2 API, e.g:

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * Retrieves the nearest package that owns (either directly or indirectly) this element, or the element itself (if it is a package).
	 * <!-- end-model-doc -->
	 * @model kind="operation" ordered="false"
	 * @generated
	 */
	org.eclipse.uml2.uml.Package getNearestPackage();


This is nice when we write Java code with the Eclipse UML2 API because we get JavaDoc hovers from the documentation in the UML metamodel!

Unfortunately, when we look at the Eclipse UML2 metamodel in the EMF EPackage registry, we get a representation of the metamodel that EMF read from the *.ecore file. It seems that somewhere in that registration process, the GenModel/documentation annotations in the *.ecore file are simply ignored.

To see this, open the MoDisco Metamodel Explorer view that shows all of the registered EPackages.
When we look at the Element metaclass from the Eclipse UML2 metamodel, we see all of the operations. When we look at getNearestPackage() above, there is no GenModel/documentation at all.

Is there a way to retrieve the GenModel/documentation metadata for elements in a metamodel in the EMF EPackage registry?

If not, how could we enhance the EMF EPackage registry to load this information in the runtime representation of a metamodel?

- Nicolas.

Re: Retrieving GenModel documentation for JavaDoc-style hovers [message #674131 is a reply to message #674118] Wed, 25 May 2011 22:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Nicolas,<br>
<br>
There's a GenModel property, suppressGenModelAnnotations, that can be
set to false to keep these things in the generated model.<br>
<br>
Please ask about EMF on the EMF newsgroup.<br>
<i><span style="color: rgb(31, 73, 125);"></span></i><br>
<br>
Nicolas Rouquette wrote:
<blockquote cite="mid:irjr0t$n3r$1@news.eclipse.org" type="cite">When
EMF loads a metamodel from the org.eclipse.emf.ecore.generated_package
extension point, I get the impression that any GenModel/documentation
annotation is ignored in the runtime representation of that metamodel.
<br>
<br>
For example, the org.eclipse.uml2.uml plugin registers this:
<br>
<br>
<br>
  &lt;extension point="org.eclipse.emf.ecore.generated_package"&gt;
<br>
   &lt;package       uri = <a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/uml2/3.0.0/UML">"http://www.eclipse.org/uml2/3.0.0/UML"</a>
      class = "org.eclipse.uml2.uml.UMLPackage"
<br>
      genModel = "model/UML.genmodel" /&gt;  &lt;/extension&gt;
<br>
<br>
<br>
The model/UML.genmodel refers to the model/UML.ecore metamodel, which
has documentation; e.g:
<br>
<br>
<br>
   &lt;eOperations name="getNearestPackage" ordered="false"
eType="#//Package"&gt;
<br>
     &lt;eAnnotations
source=<a class="moz-txt-link-rfc2396E" href="http://www.eclipse.org/emf/2002/GenModel">"http://www.eclipse.org/emf/2002/GenModel"</a>&gt;
<br>
       &lt;details key="documentation" value="Retrieves the nearest
package that owns (either directly or indirectly) this element, or the
element itself (if it is a package)."/&gt;
<br>
     &lt;/eAnnotations&gt;
<br>
   &lt;/eOperations&gt;
<br>
<br>
<br>
With the UML CodeGen extensions to the EMF CodeGen, this documentation
goes to the generated UML2 API, e.g:
<br>
<br>
<br>
    /**
<br>
     * &lt;!-- begin-user-doc --&gt;
<br>
     * &lt;!-- end-user-doc --&gt;
<br>
     * &lt;!-- begin-model-doc --&gt;
<br>
     * Retrieves the nearest package that owns (either directly or
indirectly) this element, or the element itself (if it is a package).
<br>
     * &lt;!-- end-model-doc --&gt;
<br>
     * @model kind="operation" ordered="false"
<br>
     * @generated
<br>
     */
<br>
    org.eclipse.uml2.uml.Package getNearestPackage();
<br>
<br>
<br>
This is nice when we write Java code with the Eclipse UML2 API because
we get JavaDoc hovers from the documentation in the UML metamodel!
<br>
<br>
Unfortunately, when we look at the Eclipse UML2 metamodel in the EMF
EPackage registry, we get a representation of the metamodel that EMF
read from the *.ecore file. It seems that somewhere in that
registration process, the GenModel/documentation annotations in the
*.ecore file are simply ignored.
<br>
<br>
To see this, open the MoDisco Metamodel Explorer view that shows all of
the registered EPackages.
<br>
When we look at the Element metaclass from the Eclipse UML2 metamodel,
we see all of the operations. When we look at getNearestPackage()
above, there is no GenModel/documentation at all. <br>
Is there a way to retrieve the GenModel/documentation metadata for
elements in a metamodel in the EMF EPackage registry?
<br>
<br>
If not, how could we enhance the EMF EPackage registry to load this
information in the runtime representation of a metamodel?
<br>
<br>
- Nicolas.
<br>
<br>
<br>
</blockquote>
</body>
</html>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Where can I find RulesPackage.eINSTANCE ?
Next Topic:EModelElement does not extend EObject anymore
Goto Forum:
  


Current Time: Thu Apr 25 13:46:49 GMT 2024

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

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

Back to the top