Skip to content

Utility Classes

Utility classes of other languages can contain reusable methods that can be interesting for your own languages. They often have the suffix Util or Helper. Classes ending with Manager also can have those methods. You can access them through static getInstance methods or, if they are core components, through jetbrains.mps.project.Project#getComponent. To find new methods, search for nodes named [TOPIC]+ [suffix] e.g. "UI" + "Util" becomes UIUtil. If you work closely with MPS languages, search their runtime models for useful methods. For example, jetbrains.mps.ide.httpsupport.runtime.base contains a utility class HttpSupportUtil ⧉ that helps with the HTTP Support plugins.

Class Description
DirUtil ⧉ directory-related utilities
MatchingUtil ⧉ tests if two nodes match
SubtypingUtil ⧉ subtyping related utilities
CopyUtil ⧉ utility for copying models and nodes
FileUtil ⧉ related utilities
JavaNameUtil ⧉ utilities related to Java naming
NameUtil ⧉ name-related utilities, such as pluralizing or escaping strings
CopyPasteUtil/TextPasteUtil ⧉ copy-paste related utilities
ActionUtils ⧉ action-related utilities; these methods can execute actions programmatically.
NewModuleUtil ⧉ utilities associated with creating new modules, such as creating solutions or languages
TemporaryModels ⧉ utilities for creating temporary models
UIUtil ⧉ utilities related to the IntelliJ UI, such as checking for dark mode (isUnderDarcula()).
PathManager/PathManager ⧉ classes for getting all kinds of paths, such as the plugins or log folder.
ClassLoaderManager ⧉ class responsible for loading (MPS) classes
FindUsagesManager ⧉ class that has methods for invoking the find usage UI
CloneUtil ⧉ utility method for cloning a model
ModelDigestUtil ⧉ class that contains hash methods
FindUtils ⧉ class for finding nodes in MPS
MatchingUtil ⧉ method for checking if two nodes structurally match
SubTypingManagerNew ⧉ subtyping related methods such as isSubTypeOf and collectImmediateSupertypes.
SubtypingUtil ⧉ subtyping related methods such as leastCommonSuperTypes.
PersistenceUtil ⧉ methods for saving and loading models
ModelsAutoImportsManager ⧉ utility methods related to auto-importing models
ProjectManager ⧉ project-related methods, such as creating projects and attaching listeners to projects
CopyUtil ⧉ methods for copying models and nodes
ModelAccessHelper ⧉ methods for running code as a command/read/write action

Last update: July 13, 2023

Comments