Reading Diagram Properties

Diagram Properties control the way the GraphElements are displayed in MagicDraw.

General Case

Here is a sample code that shows how to get the Diagram Property, according to the key "USE_FILL_COLOR":
DiagramProperty property = graphicalElement.getProperty("USE_FILL_COLOR");

Reading a Font Property

The value of the Diagram Property created for a Font Property correspond to the Font Name.
The Style and the Size of the Font are EAnnotations of the Diagram Property.
Here is a sample code that shows how get the Style of the Font:
int style = DiagramProperties.getFontStyle(graphNode);
This will return:
Here is a sample code that shows how get the Size of the Font:
int size = DiagramProperties.getFontSize(graphNode);

Reading a Choice Property

The value of the Diagram Property created for a Choice Property correspond to the Choice itself.
The Choices List is an EAnnotation of the Diagram Property.
Here is a sample code that shows how to get the possible Choices List of the Choice:
List<String> choices = DiagramProperties.getChoices(graphNode, "LINK_LINE_STYLE");

Reading Diagram Context

A Diagram Property context allows you to find the context of the diagram.
Here is a sample code that shows how to get the Element context:
String contextId = diagram.getProperty("context");
if(contextId!=null && diagram.eResource()!=null) {
EObject context = diagram.eResource().getEObject(contextId);
}

Related concept
Diagram Interchange

Related tasks
Managing Diagram
Writing Diagram Properties

Related reference
MDAccess for UML API Reference
MDAccess for MagicDraw API Reference
DiagramProperties