Plugin and RCP¶
The following languages create a bridge between MPS and the IntelliJ platform for cases where no language exist for using IntelliJ platform features or the MPS languages are missing features.
Actions Filter¶
com.mbeddr.mpsutil.actionsfilter
MPS contains many actions that end users might not need, such as actions for language development and actions of the IDE platform. This language allows disabling
actions inside an MPS plugin solution by defining an actions profile. Active by default can
be set, including an activation condition to make this profile the active profile when opening the project or RCP. All actions are deactivated in a tree view and can be selected to disable them. To allow actions instead of filtering them use the intention Use allow actions
in the
actions profile declaration. Actions in the section specify toolbar
appear in the main toolbar. This toolbar
can be found at the top left of the window.
To use the language, you must install the language and the corresponding IntelliJ plugin. ./gradlew install
can install this plugin. Without the plugin, the language won't load at all.
When making changes to the language, deactivate the plugin in the preferences so that the model is not read-only. Execute ./gradlew install
to install the plugin after changing and restart MPS to test it.
The user can customize the predefined actions profiles in preferences → Appearance & Behavior → Actions. New profiles can be created by clicking the + button and deleted by clicking the - button.
Preference Form¶
com.mbeddr.mpsutil.preferenceform
This language allows adding new preference pages to Preferences→Other Settings. The language uses the IntelliJ platform mechanism for adding preference pages (documentation ⧉).
Example:
It supports the following options:
- Scope: Save the preferences on the application or project level
- Help Topic: The help topic is an internal identifier that can link a page in the MPS documentation.
Example:
preferences.intentionPowerPack
links to https://www.jetbrains.com/mps/webhelp/?preferences.intentionPowerPack which redirects to https://www.jetbrains.com/help/mps/intentions-settings.html. The base URL in MPS is defined as the XML configuration of a few plugins. To get the other internal names, search forgetHelpTopic
in the MPS repository and the IntelliJ Community repository ⧉.
The preference form supports a few different input elements:
- password field
- checkbox
- dynamic combo box
- integer field
- predefined combo box
- text field
The before write method is called when you press Apply or OK. This method should update all tools or classes that reference the values of the preference form. Access the input fields through the this variable. Example:
MPS calls the after read method after the state is loaded (e.g. when the preference form is opened).
Wizard (Process)¶
com.mbeddr.mpsutil.process
This language allows creating wizards with multiple steps:
Create a new node of instance Process ⧉. The wizard can have input parameters and produces one output. After defining the wizard, you can invoke it from an action. Example:
The show method shows the modal dialog and checks if it was closed with the exit code OK. The finish method executed the onFinish callback of every step. For more information, look at the example ⧉.
New Model (RCP)¶
com.mbeddr.mpsutil.rcp
This language allows creating a new action for creating models like the action New model ⧉ of mbeddr. Create an instance of NewModelDialogConfig ⧉. The following settings are supported:
- name: the name of the new action
- caption: the text that's shown for the action
- user can change persistence: a boolean flag that decides if the user can change the model's persistence type.
- default persistence: the kind of model persistence when creating the model
- optional devkits: automatically added devkits when creating the model
- show model properties: Open the model properties after creating the model
SPreferences¶
com.mbeddr.mpsutil.spreferences
This extension allows the definition of preference pages by using MPS models. On the preference page, you get a regular MPS editor, as exemplified by the mbeddr platform ⧉ templates preference page:
Such pages are defined using an instance of PreferencePageDescription ⧉ (check out the root "Platform Templates" as an example). This instance must reside in a plugin solution. The data, i.e., the respective MPS model, is stored as part of the respective project or in MPS globally (this is configurable). It is possible to access the model that contains the preferences via code: