Skip to content

Hacks

Language Namespace : de.slisson.mps.hacks

Editor Hacks

This module contains editor-related helper classes:

  • AbstractEditorRegistry/ConceptEditorRegistry/ConceptEditorUtil: utility methods for getting editors for concepts
  • DummyReferenceLink: reference link implementation with just a name without any other functionality implemented except equality comparison to other links.
  • EditorCacheHacks.noCaching: the MPS editor is normally cached. With this method, a random cell context hint is added, so that the provided runnable runs with an editor that isn’t cached.
  • EditorCellCreator: returns a new editor cell for a node with some initial editor hint. It uses a headless editor component to achieve this.
  • EditorComponentHacks: find all editor components in every window and tool
  • SavedCaretPosition: class for saving and restoring the caret position in the editor. This class can be useful, for example, to find a new cell for the caret after a cell is removed from the editor.
  • SubstituteUtil: create substitute entries for children of a node by creating a SubstituteInfo instance. There are languages where this could be useful, for example, when creating a completely dynamic table with the table language where you have to set the substitution info yourself.

Reflection

This language bypasses some restrictions of the Java access modifiers by providing language concepts for the Java reflection API. It can access fields, static fields, methods and static fields that are normally not accessible because of the used modifiers such as the protected and private modifier.

Always try to find a public API before using this language. When using internal fields or methods, there’s always the possibility that the code will break in the feature because the class design changed. It was initially developed to overcome some limitations in MPS.

XModelGen (deprecated/not working anymore)

This language added the ability to add mapping configuration steps to generator plans.