Child pages
  • MPS Frequently Asked Questions
Skip to end of metadata
Go to start of metadata


I want to create method public static void main(String[] args) but I cannot enter the '[' and ']' characters to make it a String array. Is there some trick?

To create a String array type, first create 'String' type.
In context of a method declaration you cannot create the 'String' type on its own, only as part of the method parameter declaration.
Thus the first step is to create method with 'String' parameter:

Then, put caret at the position just after the 'String' and type '[]'.
After that the 'String' type will be replaced with 'String[]' type.

If instead of typing '[]' character you press Space and then press Alt-Enter (show auto-completion menu), then apart form the 'to array type' option, you will find a couple other options allowing you to transform the original 'String' to something else.

Project setup

How to tell mps to use my own java classes so that i can use them inside a generator template?

To use external classes in generator templates you should setup the 'classpath' property in your generator's owner language.
In the language properties dialog find the 'class path:' section, put caret into the '...' field and press <enter> to add new entry.
Then choose path to your classes or choose jar file.
If you need more classpath entries - press <enter> again.

MPS will create one stub model for each package in your classpath. Those models will have name like: <package name>@java_stub

Before using those classes in your model you have to import corresponding stub models to your model (similar to the package importing in java).
You can do that using the model properties dialog or by hitting ctrl-M in editor (providing that one of your model's node is showing in editor).

See also MPS Project Structure

  • No labels