EA_OnRetrieveModelTemplate

Details

EA_OnRetrieveModelTemplate requests that an Add-In pass a model template to Enterprise Architect.

This event occurs when a user executes the Add a New Model Using Wizard command to add a model that has been defined by an MDG Technology. See the Incorporate Model Templates topic for details of how to define such model templates.

Syntax

Function EA_OnRetrieveModelTemplate(Repository As EA.Repository,sLocation As String) As String

The EA_OnRetrieveModelTemplate function syntax contains the following elements:

Parameter

Type

Direction

Description

Repository

EA.Repository

IN

An EA.Repository object representing the currently open Enterprise Architect model. Poll its members to retrieve model data and user interface status information.

sLocation

String

IN

The name of the template requested. This should match the location attribute in the <ModelTemplates> section of an MDG Technology File. For more information, see the Incorporate Model Templates in a Technology topic.

Return Value

Return a string containing the XMI export of the model that is being used as a template.

Example

 

Public Function EA_OnRetrieveModelTemplate(ByRef Rep As EA.Repository, ByRef sLocation As String) As String

       Dim sTemplate As String

       Select Case sLocation

               Case "Templates\Template1.xml"

                       sTemplate = My.Resources.Template1

               Case "Templates\Template2.xml"

                       sTemplate = My.Resources.Template2

               Case "Templates\Template3.xml"

                       sTemplate = My.Resources.Template3

               Case Else

                       MsgBox("Path for " & sLocation & " not found")

                       sTemplate = ""

       End Select

       EA_OnRetrieveModelTemplate = sTemplate

End Function