Share via


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

  1. 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.

  2. Optionally, add decorators, such as text and an icon, to the compartment shape. For more information, see How to: Add a Decorator.

  3. Optionally, add domain properties to the compartment shape. For more information, see How to: Add a Domain Property.

  4. Set any properties in the Properties window.

    For example, you can change the default value of the OutlineColor property from black to gray.

  5. Right-click the Compartment, click Add New Compartment, and type a unique name for the compartment.

  6. 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.

  7. 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.

  8. 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.

  9. Click Transform All Templates in Solution Explorer.

  10. 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

Defining Diagram Elements

How to: Add a Compartment Shape (DSL Explorer)

Domain-Specific Language Tools Glossary