Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Content layer
id572341248
Content column
id572341251
Content block
id572341250

We will demonstrate the recommended step-by-step instructions on how to customize an element, how to begin to create customization, how to create customization data, and how the customization data will be represented on the DSL element. 

  1. Create a new project and  and name it it Organization_Stereotypes.mdzip.
  2. Create a

    profile and

    Profile element and name it

    stereotypes

    Stereotypes.

    Tip
    titleStereotypes

    The purpose of the

    stereotypes package

    Profile named Stereotypes is to store all the stereotypes. Later we will share the package in order to use the stereotypes in the customization project. 

    Create a profile diagram and name it
  3. In the Profile element, create a Profile Diagram and name it Stereotypes.

    Tip

    The

    profile diagram

    Profile Diagram palette contains all the necessary buttons for the customization creation

    buttons

    .

  4. In the Profile Diagram, create a Stereotype element and name it Company.

  5. Apply the Class metaclass to the Company StereotypeCreate a stereotype, apply the Class metaclass, and then name the stereotype Company.

    Image Modified





    Tip
    • You can see how customization rules will be passed to the DSL element by using the stereotype.

    • We selected the Class metaclass, because the «Company» stereotype will be applied to a class element. In other words, the type of the DSL element will be the class.

    • You can also assign an icon to the stereotype. The icon will be represented on the DSL element. 

  6. Share the stereotypes package.

    The

    The Organization_Stereotypes.mdzip

    project

     project becomes a shared project.

    Tip

    Only the content of the shared stereotypes package will be visible in the project that will use the project. 

  7. Save the Organization_Stereotypes.mdzip project.

  8. Create a new project

    and

     and name

    it

    it Organization_Customizations.mdzip.

  9. Create a

    package

    Profile element and name

    it customizations

    it Customizations.

    Tip

    The purpose of the

    customizations

    Customizations package is to store all the customization data. Later we will share the package. 

    Create a profile diagram and
  10. In the Profile element, create a Profile Diagram and name it Customizations.

    Tip

    The Customizations diagram is intended for customization elements creation. 

  11. Create

    In the Profile Diagram, create a customization element and name it Company.

    Image Modified


    Tip

    On a diagram, you can see that the customization element is a class with the applied «Customization» stereotype.

  12. Use

    the 

     the Organization_Stereotypes.mdzip project in the current project.

  13. Open

    the

    the Company

    customization element

     customization element Specification window, under

    the

    the General

    category

     category, click

    the

    the Customization Target

    property

     property and then specify

    the

    the Company

    stereotype

     stereotype.

    Image Modified


    Tip
    • To assign a customization target quickly, select the Company stereotype in the Model Browser and drag it to the shape of the Company customization element on the diagram pane.

    • In the Customization Specification window, you can specify customization data that will be passed to the DSL element. 

  14. In the Company customization element Specification window, under the General category, set the Hide Metatype check box to true. If the value is true, the element acts like a new standard element type in the modeling tool.

  15. In

    the

    the Company

    customization

     customization element Specification window, under

    the

    the Owned Elements

    category

     category, click

    the

    the Possible Owners

    property

     property and then select

    the

    the Package

    metaclass

     metaclass.

    Image Modified


    Tip

    The DSL element will be added to the package shortcut menu, under the Create Element command.

  16. After click on the Possible Owner property, the element Selection dialog appears. In this dialog, by default metaclasses are not displayed. To display the Package metaclass, click the Include meta classes into search results button. 
  17. Share the customizations

    Share the Customizations package. The Organization_Customizations.mdzip project with the shared 

    customizations

    Customizations package becomes a shared project.

  18. Save

    the

    the Organization_Customizations.mdzip

    project

     project.

  19. Create a project and name it

    Organization

     Organization.

  20. Use

    the

    the Organization_Customizations.mdzip project in

    the

    the Organization

    project

     project.

    Tip

    The Organization_Stereotypes.mdzip project will be used in the Organization project automatically, because the Organization_Customizations.mdzip project uses the Organization_Stereotypes.mdzip project. 

  21. In the Organization project, create a Package and in that package, create a class element and name it NoMagic.

  22. Apply

    the

    the Company

    stereotype

     stereotype to

    the

    the NoMagic

    class

     class element.

  23. Save and reopen the project.

In the following figure, you can see the Containment tree of the project with the used Organization_Stereotypes.mdzip and Organization_Customizations.mdzip projects.

Image Modified


Structure of a project that use other projects


In this example, the «Company» stereotype is applied to the NoMagic class element. You can see that the Company element is added to the package shortcut menu.



Example of the “Possible Owner” property realization


Note
titleCreate Element

If you do not want the new DSL element to appear on the Create Element menu, you can hide the appropriate command when customizing your modeling tool perspective


Content block
id572341246

Related pages