Creating a Generated File for the Message Information

Having created templates to extract information about the messages in the model, we need to create a generated file to contain and display them on the Preview tab of the diagram property sheet. We will define the file on the BasePackage metaclass, which is the common class for all packages and models, and will have it loop through all the communication diagrams in the model to evaluate the template description defined on the CommunicationDiagram metaclass.

  1. Right-click the Profile category, select Add Metaclasses to open the Metaclass Selection dialog, click the Modify Metaclass Filter tool, select Show Abstract Modeling Metaclasses, and click the PdCommon tab.
  2. Select BasePackage and click OK to add it to the extension file.
  3. Right-click the BasePackage category and select New > Generated File to create a file under the metaclass.
  4. Enter the following values for the file properties:

    Field

    Value

    Name

    Communications Textual Descriptions

    File name

    %Name% Communication Description.txt

    Encoding

    ANSI

    Use package hierarchy as file path

    [unselected]
  5. Enter the following code in the text box:
    .foreach_item(CollaborationDiagrams)
     %description%
    .next(\n\n) 


  6. Click Apply to save your changes, and then OK to close the resource editor.
  7. Click OK to close the List of Extensions.