M PLUS Plug-in

M PLUS is a Model-driven development (MDD) Plug-in for Astah which enables you to generate C++/Python/Ruby/Swift/VDM++/Golang/Scala/Kotlin/Alloy Source Code from UML Classes. Like Acceleo, MOFScript and Xpand, the M PLUS Plug-in has the ability to preserve the code you directly add into generated code. So you can generate code from the same model while preserving the code you add to the previously-generated code.


   How to Install

  1. Download the Plug-in file by clicking the blue Download button at the top of this page.
  2. After the download is complete, drag the downloaded .jar file to an open instance of Astah. A pop-up will appear asking you to confirm installation choose [Yes].
  3. If the pop-up below opens, restart Astah.
    astah plugin menu
    The [Plugin] menu exists in version 7.2 or later. if you are using version 7.1 or earlier, read this FAQ.
  4. Install is complete if [M+] tab is added in the "Extra View" below the diagram editor.
    Database Reverse Plugin
    If Extra View is not opened, go to [View] - [Show/Hide Extra View].
    Database Reverse Plugin

   How to Use

  1. Go to [M+] tab below diagram editor. Then specify a directory where you want to generate the source code to.
    Database Reverse Plugin
  2. Choose a programming language you'd like export into.
  3. Create a model or open .asta file.
  4. In the structure tree, select the model(s) - Class, Package or a root project that you want to generate the source code of. If your selected models contain sub-packages and models, all of those models will be generated.
  5. Click [Generate Code] button in the [M+] view or use shortcut key [Alt + C] if you are on Windows or Linux.
  6. Once the source code is generated, the result appears in the view. Directly double-clicking the file path will open the file in an editor..=
  7. Modify the code in the "User Code Area" - which is an area quoted with "// ˅" and "// ˄". (Lines in lime green in the figure below.) The code you add in the User Code Area will be preserved for subsequent code generations just like how "User Code Blocks" with Acceleo, "Unprotected Blocks" with MOFScript and "Protected Regions" with Xpand work.

    Attention-1: Do not add code other area than "User Code Area", it might clear out all the codes in the "User Code Area".

    Attention-2: Do not add code in the line where "// ˅" and "// ˄" are.
    Attention-3: Source code will be generated in UTF-8 without a BOM.
  8. Repeat step 3-7. If the code was modified from previous generation, the file path will appear in black and unmodified files will appear in grey.
  9. Close your project. When the file is saved after code generation, the configuration file (m_plus.conf) will be automatically saved in the same directory where the .asta file is saved. Keeping this configuration file means you don't have to re-set the target directory every time you generate the code. You may want to save this configuration file in version control such as Git or Subversion.