Creating textual element representation
Use com.nomagic.magicdraw.uml.RepresentationTextCreator to create a textual representation of Element. This utility class is used for creating a textual element representation in various UI - trees, list and etc.
Element element = ...
//create a preformatted text for any kind of element
String text =RepresentationTextCreator.getRepresentedText(element);
//create a text with special options for com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property
Property property = ...;
String propertyString = RepresentationTextCreator.createPropertyText(property,
true
,
true
,
true
,
true
,
true
,
false
,
false
,
false
,
true
,
false
);
Providing a custom representation text
You can override default custom text creation for the specific element.
Use RepresentationTextCreator class method addProvider(RepresentationTextCreator.RepresentationTextProvider) to register a custom representation text provider.