29 déc. 2011

Extract relevant elements from a diagram

I would like to introduce in this post a new feature which will be available in the next release of Gendoc2.
This feature makes possible to extract elements you desire in a diagram.

This example will generate a part of the UML Metamodel documentation.
The diagram realized with MDT Papyrus is presented bellow:
This diagram displays some information about Events, Activity Nodes and Operations. For the documentation we only want to display the elements linked to the Signal Event and the Call Event meta classes.

This is now possible using new methods in TOPCASED and GMF bundles.
This is the code to use in your gendoc2 template :

  1. The diagram is get using getPapyrusDiagrams() method
  2. A list of visibleElements is computed using a focused class (SignalEvent or Call Event)
    • [let visibleElements : Set(uml::Class) = Set{focus}->union(focus.superClass)->union(focus.superClass->closure(superClass)->union(focus.getAssociations().memberEnd->select(type <> focus).type->asSet()))]
  3. The list of visible elements is used by the getDiagram method
  4. Finally the elements visible in the diagram are listed and for each element the documentation is displayed
The result is visible bellow

3 commentaires:

  1. gendoc2

    I can t convert for document word the javadoc tag comment content inside
    i use richText but that do nothing, if use without, the document docx generated is corrupted.

    i don t want use documentation, that give double work for generate document and javadoc but tag html make trouble with illegal caracter like
    inside javadoc comment.

    if you can do a log before docx generation, it would be nice, because when the docx is corrupt, it is hard to find the error and waste much time.

    Thanks for solution

    1. Can you send an example of the content to see what is contained in the body field ?


    2. in docx

      sample in docx unloadable
      ....create from source xxx< br />action date are form current system date< /w:t >

      uml file, javadoc tag, body part

      .... create from source xxx<br />action date are form current system date ....

      tag html seem not supported by blog,i must insert space