The DSL graphical notation will now be customized:
- Rename ExampleShape to ClassShape.
- Change the Fill Color property of ClassShape to a suitable colour.
- Change the Geometry property of ClassShape to rounded rectangle (the standard for UML class diagrams).
- Add a text decorator to ClassShape called Visibility. This is necessary so that the user can enter a visibility level (public, private etc.). To do this, right-click on ClassShape and select Add->Text Decorator.
- Map the Visibility text decorator to the Visibility property of Class in the DSL Details window. To do this, click the DSL Details window, and select the line that links ClassShape to Class. In the DSL Details window, select the Decorator Maps tab, select the Visibility check box, and then set the Display Property combo box to Visibility. This ensures that when the user enters a class visibility, that it will be stored in the Visibility property of Class. Close the DSL Details window.
- Rename NameDecorator to Name.
- Rename ExampleConnector to ClassConnector.
- Change the Target End Style property of ClassConnector to Hollow Arrow (the standard for UML class diagrams).
After making these changes, your domain model should look like:
Customizing the DSL Toolbox
- In DslExplorer, expand Editor/Toolbox Tabs/MyDslSample/Tools.
- Change the Name property of ExampleElement to Class.
- Change the ToolTip property of ExampleElement to “Creates a Class”.
- Change the Name property of ExampleRelationship to Inheritance.
- Change the ToolTip property of ExampleRelationship to “Drag between Classes to create an Inheritance relationship”.
Click the Transform All Templates button. Once the template transformation process has finished, build the application and run it without debugging. The DSL will launch in the Visual Studio Experimental Hive.
No comments:
Post a Comment