MPS 2019.3 Help

Scripts

The scripts aspects lets you perform changes to your models in batches. The available scripts are shown in the Tools -> Scripts menu.

Scripts use
There are two types of scripts:
  • enhancement - perform a change to the model based on criteria that you specify

  • migration - a deprecated type that used to be utilized for migration between language versions. Language migrations now take care of this functionality and so migration scripts are no longer available top be created.

To define your scripts, create the Scripts aspect in your language and then create an Enhancement Script.
Scripts language mig script

Give it a name and a descriptive title. 

Scripts name
Then you specify one or more updaters. They are of several kinds.
Scripts updaters

Concept instance updater

The "concept instances updater" allows you to specify a query to get the nodes that you are interested in and then provide code that will update the found instances.

Scripts instance updater
The "show as intention" flag
Scripts intention flag

will offer the script in the intentions menu in the editor right next to the nodes that satisfy the query.
Scripts intention

Factory method updater

Scripts factory use
This updater calls a factory method that is supposed to return instances of the AbstractMigrationRefactoring class that implement the filtering and enhancement functionality in BaseLanguage.
Scripts factory

Extract interface updaters

The extract interface updater comes in handy when you want to replace references to methods of a class to methods of another class or of an interface.

Scripts extract
You specify both the current and the desired target classes and then with the “pull up method” statement you indicate references to which methods to change and to what to change them.

Last modified: 4 February 2020