预订演示

请注意 : 本帮助页面不适用于最新版本的Enterprise Architect. 最新的帮助文档在这里.

前页 后页

EA_OnRetrieveModelTemplate

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.

Syntax

Function EA_OnRetrieveModelTemplate (Repository As EA.Repository, sLocation As String) As String
The EA_OnRetrieveModelTemplate function syntax contains these parameters.

Parameter

Type

See also

Repository

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

sLocation

String
Direction: IN
Description: The name of the template requested; this should match the location attribute in the <ModelTemplates> section of an MDG Technology File.

Return Value

Return a string containing the XMI export of the model that is being used as a template.
Return an empty string if access to the template is denied; the Add-In is to handle user notification of the error.

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

Learn more