MPS 2023.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.png

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

Give it a name and a descriptive title.

Scripts_name.png

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

Scripts_updaters.png

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

The "show as intention" flag

Scripts_intention_flag.png

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

Scripts_intention.png

Factory method updater

Scripts_factory_use.png

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

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

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: 07 March 2024