Skip to content

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.

example: actions filter

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 preferencesAppearance & BehaviorActions. New profiles can be created by clicking the + button and deleted by clicking the - button.

actions filter preferences

Preference Form

com.mbeddr.mpsutil.preferenceform

This language allows adding new preference pages to PreferencesOther Settings. The language uses the IntelliJ platform mechanism for adding preference pages (documentation ⧉).

Example:

example: preference form

It supports the following options:

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:

1
2
3
final HttpServerConfig config = new HttpServerConfig(((int) this.port), this.enabled); 
HttpServerConfig.setCurrentConfig(config); 
extensionPoint/HttpServerConfigChangeListener/.objects.forEach({~it => it.serverChanged(config); });

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:

example: single step of a custom wizard

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:

1
2
3
4
wizard<theProcess> wiz = createWizard<theProcess>("This is my testdata");
boolean b = wiz.show;
System.out.println("show == " + b);
wiz.finish;

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:

example: spreferences

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:

spreferences: query

Comments