How to: Add a Compartment Shape to a Domain-Specific Language Definition
You use compartment shapes to add compartments to a domain class. In each compartment, you can add a grouping of related items to the domain class. You define these items in a separate domain class and you establish them with compartment maps by using the DSL Details window. For information about how to customize a compartment shape, see Compartment Shape (Domain-Specific Language Designer). You can find an example of a compartment shape in the Class Diagram sample. For more information, see Class Diagram Sample (Domain-Specific Langauge Tools).
After you create and define a compartment shape, you must map it to a domain class. For more information, see How to: Add a Domain Class to a Domain-Specific Language Definition and How to: Map Elements By Using the Diagram Element Map Tool.
To add a compartment shape to a domain-specific language definition
In the Toolbox, on the Dsl Designer tab, drag a compartment shape onto the diagram surface of the Domain-Specific Language Designer.
A compartment shape that is named CompartmentShape1 is created in the designer definition under the Diagram Elements swimlane.
Optionally, add decorators, such as text and an icon, to the compartment shape. For more information, see How to: Add a Decorator.
Optionally, add domain properties to the compartment shape. For more information, see How to: Add a Domain Property.
Set any properties in the Properties window.
For example, you can change the default value of the OutlineColor property from black to gray.
Right-click the Compartment, click Add New Compartment, and type a unique name for the compartment.
Set any properties in the Properties window for the compartment. For example, you can change the value of the Default Expand Collapse State property from expanded to collapsed.
Map the compartment shape to the domain class or named domain class by using the Diagram Element Map tool. For more information, see How to: Map Elements By Using the Diagram Element Map Tool.
Click the mapping line between the compartment shape and the domain class to which it is mapped, and map the individual compartments in the DSL Details window. For more information, see How to: Define Compartment Settings of Diagram Element Maps.
Click Transform All Templates in Solution Explorer.
On the Build menu, click Rebuild Solution to start a Visual Studio experimental build to display how the compartment shape has been defined and mapped to a domain class.
See Also
Concepts
Domain-Specific Language Designer Terminology Overview