How to Create and Use Hyperlinks
UModel allows hyperlinks between most modeling elements (except for lines) and:
•any diagram in the current ump project
•any element on a diagram
•any element in the Model Tree
•external documents, e.g. PDF, Excel or Word documents
•web pages
See also: Hyperlinking modeling elements.
Hyperlinks are not part of the UML specification and the UModel API introduces the following interfaces for hyperlinks on
•IUMLHyperlink is the common base interface and can be used to open links as well as to retrieve the default- and user-defined link name
•IUMLHyperlink2File to handle external documents and web pages
•IUMLHyperlink2GuiElement to handle any diagram in the current ump project or any element on a diagram
•IUMLHyperlink2Model for hyperlinks to model elements (in the Model Tree)
Examples
Insert a hyperlink to the Altova homepage:
IUMLHyperlink2File iHyperlink = iMyClass.InsertOwnedHyperlink2FileAt(-1, "https://www.altova.com"); |
Insert a hyperlink to a diagram of the current ump project:
IUMLGuiDiagram iDiagram = ...; |
Insert a hyperlink to the representation of a class on a diagram:
IUMLGuiNodeLink iNodeLink = ...; |
Insert a hyperlink to an attribute of a class on a diagram:
IUMLGuiNodeLink iNodeLink = ...; |
Insert a hyperlink to the same attribute (from above) in the Model Tree:
IUMLHyperlink2Model iHyperlink = iMyClass.InsertOwnedHyperlink2ModelAt(-1, iAttribute); |
Open all hyperlinks of an IUMLNamedElement:
foreach (IUMLHyperlink iHyperlink in iMyClass.OwnedHyperlinks) |
UModel also allows hyperlinks in notes (IUMLGuiNote) and comments (IUMLComment):
These are handled by IUMLGuiTextHyperlinks (respectively IUMLCommentTextHyperlinks) and the start- and end-character position of the hyperlink must be specified, e.g:
IUMLGuiDiagram iDiagram = ...; |
Similar for hyperlinks in comments:
IUMLComment iComment = ...; |