MPS 2024.1 Help

Context actions tool

The Context Actions Tool accommodates for the preference of some DSL users towards mouse navigation. It lists the actions applicable in the given context in a sidebar, potentially hierarchically organized.

The common behavior is to do something at the caret position, activated with a single click. The context actions tool is great for discovering explorative work, as it communicates clearly what kind of things are doable in this context.

cat2.png

By selecting an option in the tool window the user triggers the associated action, which typically modifies the model in the place of the current focus.

The window has an editor-independent position and contains a hierarchical menu of actions. If the menu is deeper than one level, the deeper levels will be squashed into a top-level hierarchy by concatenating the menu names with a / separator (e.g. Toplevel / SecondlevelA / ThirdlevelA ). 

The content of the sidebar is specified by the language designer through the new Transformation Menu Language.

cat1.png

The language supports modularization of the menus and their easy reuse, so combining menus of super- or sub-concepts should be quite straightforward. Once you import the jetbrains.mps.editor.contextActionsTool.lang.menus language you'll be able to specify the context action tool location for your actions, groups and other relevant elements. The language also gives you the possibility to specify an icon and a tooltip for the given entries.

For full details on the actual language syntax refer to the Transformation Menu Language page.

Last modified: 11 February 2024