EditItemLinks function (automation interface)
The EditItemLinks function allows your script to open the Links Editor for an item.
Through the EditItemLinks function, you can list standard links for the item type, or list links that are defined through a reference tag definition. Also, you can make the Links Editor list only items that are stereotyped by a specified Stereotype.
Syntax:
• To open the Links Editor for all standard roles:
Studio.EditItemLinks(<object>("Id"), "", "[<stereotype object>("Id")]")
• To open the Links Editor for a specific standard role by default:
Studio.EditItemLinks(<object>("Id"), "<standard role>", "[<stereotype object>("Id")]")
• To open the Links Editor for a specific role that is created through a reference tag definition:
Studio.EditItemLinks(<object>("Id"), "<tag definition object>("Id")", "[<stereotype object>("Id")]")
where,
<stereotype object> specifies that only items that are stereotyped by that stereotype are listed in the middle pane of the Links Editor.
The function returns TRUE is successful and FALSE if unsuccessful, such as an invalid argument.
Examples
In this example, the Links Editor is opened for Actor1 so that you can create standard links.
Dim ModelObject as Object
Set ModelObject = Dictionary.Item("Actor","Actor1")
Studio.EditItemLinks(ModelObject("Id"), "", "")
In this example, the Links Editor is opened for Actor1 so that you can create dependency links by default. You can select alternative standard links from the Types list on the Links Editor dialog.
Dim ModelObject as Object
Set ModelObject = Dictionary.Item("Actor","Actor1")
Studio.EditItemLinks(ModelObject("Id"), "dependees", "")
In this example, the Links Editor is opened for Actor1 so that you can create links to items through the MyLinks reference tag definition.
Dim ModelObject as Object
Dim TagDefObject as Object
Set ModelObject = Dictionary.Item("Actor","Actor1")
Set TagDef Object = Dictionary.Item("Tag Defintion","MyLinks")
Studio.EditItemLinks(ModelObject("Id"),TagDefObject("Id"), "")
In this example, the Links Editor is opened for Actor1 so that you can create links to items through the MyLinks reference tag definition, but in this case only items that are stereotyped by the MyStereotype stereotype are listed in the middle pane of the Links Editor.
Dim ModelObject as Object
Dim TagDef Object as Object
Dim Stereotype Object as Object
Set ModelObject = Dictionary.Item("Actor","Actor1")
Set TagDef Object = Dictionary.Item("Tag Defintion","MyLinks")
Set StereotypeObject = Dictionary.Item("Stereotype","MyStereotype")
Studio.EditItemLinks(ModelObject("Id"),TagDefObject("Id"),StereotypeObject("Id"))