MagicDraw 18.5 Documentation

Skip to end of metadata
Go to start of metadata

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 name it Organization_Stereotypes.mdzip.
  2. Create a profile and name it stereotypes.


    The purpose of the stereotypes package is to store all the stereotypes. Later we will share the package in order to use the stereotypes in the customization project. 

  3. Create a profile diagram and name it Stereotypes.

    The profile diagram pallet contains all the necessary for the customization creation buttons.

  4. Create a stereotype, apply the Class metaclass, and then name the stereotype Company.

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

  5. Share the stereotypes package. The Organization_Stereotypes.mdzip project becomes a shared project.

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

  6. Save the Organization_Stereotypes.mdzip project.

  7. Create a new project and name it Organization_Customizations.mdzip.

  8. Create a package and name it customizations.

    The purpose of the customizations package is to store all the customization data. Later we will share the package. 

  9. Create a profile diagram and name it Customizations.

    The Customizations diagram is intended for customization elements creation. 

  10. Create a customization element and name it Company.

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

  11. Use the Organization_Stereotypes.mdzip project in the current project.

  12. Open the Company customization element Specification window, under the General category, click the Customization Target property and then specify the Company stereotype.

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

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

  14. In the Company customization element Specification window, under the Owned Elements category, click the Possible Owners property and then select the Package metaclass.

    • The DSL element will be added to the package shortcut menu, under the Create Element command.
    • 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. 

  15. Share the customizations package. The Organization_Customizations.mdzip project with the shared customizations package becomes a shared project.

  16. Save the Organization_Customizations.mdzip project.

  17. Create a project and name it Organization.

  18. Use the Organization_Customizations.mdzip project in the Organization project.

    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. 

  19. In the Organization project, create a class element and name it NoMagic.

  20. Apply the Company stereotype to the NoMagic class element.

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

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

Create 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

  • No labels