You can add a new scripting language that supports JSR-223 to MagicDraw by editing the Macro Engine's plugin.xml file.

To add a new scripting language


  1. Open the plugin.xml file in <MagicDraw>/plugins/com.nomagic.magicdraw.automaton/plugin.xml.
  2. Add the following jar file tags to the runtime section and save the file.
... <library name="<path to jar file>"/>

 

The path to the jar file is relative to <MagicDraw>/plugins/com.nomagic.magicdraw.automaton or the absolute pathname can be used, for example, if you want to add Sleep programming language, add the following tag to the runtime section:

... <library name="c:/sleep_2.1.jar"/>

 

A slash (/) is used as a directory separator for all platforms, including Windows. The new language will be displayed in most of the Macro Engine dialogs, for example,  in the Macros section in the Environment Options dialog, the Create Macro dialog, and in the Macro Information dialog. The language name is automatically configured from the information inside the jar file. This version of Macro Engine does not allow you to modify the language name.

Script Filename Extension Filter

When you open an Open file dialog to browse for a script file in Macro Engine, you can find the filename extension for the script file in the dialog file filter. If you have added a new scripting language to MagicDraw, for example, Sleep programming language, Macro Engine will add the filename extension (*.sl)” in the Open file dialog, see figure below.

New Script Extension in File Type Filter

The filename extensions are derived from jar files. There can be more than one filename extension for each engine. However, the current Macro Engine version only shows the first filename extension that is queried from the engine jar file.

You can remove a scripting language from Macro Engine by removing the associated library tag in the plugin.xml file. Once the tag has been removed, the language will be removed from all of the dialogs in Macro Engine. However, the script configured to be used with the language will not be removed from MagicDraw. The language of the script will be reset to the default language, which has been previously configured in the MagicDraw Environment Options dialog.