Features

Coming soon in 3.4 – Icon description language

Here’s another handy new little feature in 3.4 that we want to introduce to you – the Icon description language. This language helps describing and instantiating icons for various MPS elements: concepts, actions etc. Again, mbeddr has inspired us here, namely their iconchar language.

The langage has two aims:
1. Allow for quick icon prototyping (e.g. making new icons for concepts)
2. Make icons an extensible language construct rather than an ad-hoc solution, which it was before

First impression

Wherever an icon is expected in the MPS language definition languages, you can enter a textual description of the desired icon instead of pointing to an existing .png file.

icon4

An icon description consists of layers, each of which can be any of:

  • a primitive graphical shape
  • a custom image loaded from a file
  • a character

These layers are then combined into a single image to represent the icon.

icon5

Creating icon prototypes

When describing an icon, you can get assistance from the Create Icon intention, which offers an automatic way to create a textual description of an icon and thus to prototype it quickly.

icon1

Invoking the intention will result in creating a straightforward icon definition.

icon2

This definition describes a circular icon with letter “X” inside of it. Upon regeneration the generated icon will take effect and shows up in the UI. (The recent EAP release demands a restart, though.)

icon3

The use of icons

The jetbrains.mps.lang.resources contains two constructs:

  • icon{} represents the image as an instance of javax.swing.Icon class.
  • iconResource{} returns an instance of jetbrains.mps.smodel.runtime.IconResource class.

These icon descriptions can be used:

  • to specify icons in different places of the language definition languages – in concepts, actions, etc, where icons are expected
  • in methods in the MPS UI that are supposed to return an Icon

Check out full documentation of Icon description language for more details on how to use and extend this feature.

The Drive to Develop
-JetBrains MPS Team

image description