Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Run Add-In Functions

Another facility that you can provide to support users of your technology is to run Add-In functions from a Learning Center page.  You define each function using an attribute in the Learning Center Stereotype element, the attribute having the format:

"Assembly::FunctionName()"

 

Assembly is the name of the Add-In and FunctionName is the name of the public function to run, within the Add-In. Type the text that is to appear in the Learning Center page into the Initial Value field of the attribute.

Example

This function is written under VB.Net:

 

Public Function ShowMyDiagram(ByRef Repository As EA.Repository, ByVal args As Object) As String

    Dim ret As String

    ret = Repository.SQLQuery("select ea_guid from t_diagram where diagram_type='Custom' and styleex like
     '*;MDGDgm=MyDiagrams::MyCustomDiagram;*'")

    If ret Is Nothing Then

         ShowMyDiagram = False

         Exit Function

    End If

 

    Dim oXML As MSXML2.DOMDocument = New MSXML2.DOMDocument

    oXML.loadXML(ret)

 

    Dim NodeList As MSXML2.IXMLDOMNodeList = oXML.selectNodes("//ea_guid")

    If NodeList.length = 0 Then

         ShowMyDiagram = False

         Exit Function

    End If

 

    Dim Node As MSXML2.IXMLDOMNode

    Dim diag As EA.Diagram

    If NodeList.length >= 1 Then

         Node = NodeList.item(0)

               diag = Repository.GetDiagramByGuid(Node.text)

         Repository.OpenDiagram(diag.DiagramID)

         Repository.ShowInProjectView(diag)

    End If

 

    ShowMyDiagram = True

End Function

 

Learn more