First modeling steps

This section explains how to open the Language Dsl Designer and how to start modeling languages with PDE.

  1. Open the Language DSL Designer
  2. Create new Domain Elements and -Relationships
  3. Add shape information for Domain Elements
  4. Transform templates
  5. Compile Project

Open the Language DSL Designer

After creating a solution for your PDE Project, you will have a file called "DomainMetaModel.lngdsl" in your solution. This file represents your DSL model, which you can and should edit to fit your needs. To open this file in the Language DSL Designer you can either double click the "DomainMetaModel.lngdsl" file (doesn't always work) or right click on the "DomainMetaModel.lngdsl" file and select Open With, which will open a dialog where you can select WPFDesigner and further click on OK. This will open the "DomainMetaModel.lngdsl" file in the Language DSL Designer.

Open Language DSL Designer

Within this editor you can create the language meta-model (DSL model), which defines the elements and relationships of your language. Additionally, you can define diagram classes, which will be used for representation later on.

Hint: You'll have to save the DSL model at least once before transforming templates!

Create new Domain Elements and -Relationships

After opening the DSL model in the Language DSL Designer you can start adding Domain Elements and/or Relationships. To add Domain Elements you can use the context menu on the diagram surface, which will provide different options based on the current selection.

Edit model

To create Reference or Embedding Relationships you can either use the context menu or the process shown in the figure below: Start by clicking and holding the left mouse button over a triangle on the left side of a Domain Element and move the mouse over a different (or the same) Domain Element and let the left mouse button go. A dialog will appear letting you choose the type of relationship (referencing or embedding) you'd like to create and further will proceed to create the relationship between those two Domain Elements.

Create RS

Add shape information for Domain Elements

Every language created with PDE provides a graphical designer surface, which can be used to create Domain Elements as well as relationships between those elements. To specify which elements should be creatable on the diagram surface, shape information in terms of a Shape Mapping needs to be specified (the corresponding process is shown in the figure below).

PDE Shape mapping

  1. Select a Domain Element and open the context menu (right click on the Domain Element). Select "Add mapping to new shape class" menu item.
  2. A popup window will open and let you decide on which Diagram Class to add this new shape. PDE allows the user to have multiple diagram classes in one language acting as standalone views (diagram classes can also be included in the main diagram designer allowing the definition of shapes to be provided at multiple places, with the integration taking place at code generation time).
  3. A new shape class for our Domain Element is added to the diagram class.
  4. A reference to a shape information is also shown on the main model view.

The process for creating a shape mapping for relationships is the same.

Hint: For every shape class specified a WPF DataTemplate is generated, which provides a default Xaml for visualization (can be partially modified through the properties of the shape in the property window). This DataTemplate can be also provided by the user allowing the creating of more complex shapes. For that, one has to add a specific DataTemplate (shown below) to the Resources.xaml file (or any resource dictionary included by the project) and set the property "IsAutoGenerated" of the shape class to false.


    <DataTemplate DataType="{x:Type c:***ShapeClassName***DiagramItemViewModel}">


The figure below shows a sample we have created so far:

PDE Sample Model

Transform templates

Anytime you change your DSL model a transformation process, generating source code based on your DSL model, is required. To start the transformation process, click on the Transform All Templates menu item as shown in the figure below.

Transform templates

Compile Project

After compiling our project, we have a WPF application to edit instances of the example model created above. This application looks like this:



Last edited Oct 7, 2010 at 10:02 AM by evgenij84, version 19


No comments yet.