Altova UModel 2025 Enterprise Edition

How to Use Predefined UModel Elements

Home Prev Top Next

UModel defines several important elements as "predefined". This includes several internal elements (Root, Component View and Unknown Externals package) as well as the elements of all profiles installed with UModel (e.g. the C#, VB and Java profile).

 

Predefined elements can be uniquely identified by using ENUMUMLPredefinedElement, which allows direct and easy access to these elements for several functionalities, for example:

 

Find a predefined element:

 

// get the CSharp profile
IUMLProfile iCSharpProfile = (IUMLProfile) iDoc.RootPackage.FindPredefinedOwnedElement(ENUMUMLPredefinedElement.ePredefined_CSharp_Profile, false);

 

Apply a predefined stereotype:

 

// set the CSharp 'delegate' stereotype
iClass.ApplyPredefinedStereotype( ENUMUMLPredefinedElement.ePredefined_CSharp_delegateStereotypeOfClass );

 

Check if a predefined stereotype is applied:

 

// check if package is a CSharp - namespace (if 'namespace' stereotype is applied)
bool bIsCSharpNamespace = iPackage.IsPredefinedStereotypeApplied( ENUMUMLPredefinedElement.ePredefined_CSharp_namespaceStereotypeOfPackage );

 

Set the tagged value of a predefined tag definition:

 

// set attribute-section "STAThread"
// ...
iStereotypeApp.SetPredefinedTaggedValueAt(-1, ENUMUMLPredefinedElement.ePredefined_CSharp_attributesStereotypeOfClass_sectionsProperty, iSTAThread.Name);

© 2018-2024 Altova GmbH