Skip to content

IntelliJ UI

Swing Components

  • Use components from the IntelliJ platform. The IntelliJ Platform Plugin SDK mentions some more components. Use the IntelliJ platform UI guidelines ⧉ to create consistent and usable user interfaces.
  • Capitalization: Most short textual items (menus, buttons, labels, for example) should have headline capitalization. Capitalize all words except for common words with up to three letters (a, an, the, and, or, so, yet, etc.) that don't appear as the first or last word. If the text isn't short, you should use capitalization in ordinary prose (sentence capitalization) instead.
  • Read the Swing tutorials ⧉ to get a better understanding of the components.

Where can you find an overview of the user interface?

The IntelliJ IDEA documentation ⧉ explains the user interface from a user perspective. The IntelliJ Platform Plugin SDK ⧉ contains a more technical explanation.

What exactly is an MPS action? How do they work?

The MPS actions compile down to IntelliJ platform actions ⧉, so you see actions from MPS and the IntelliJ platform (e.g., Close Floating Navigation Bar). Most icon buttons, like the buttons in the upper right corner of the window, or the image buttons in the MPS tools, are also IntelliJ buttons.

Actions that you can turn on or off are of type ToggleAction ⧉. They are used, for example, in KernelF in the run menu. A deprecated concept addJavaAction lets you add IntelliJ actions when referencing actions in an MPS plugin.

To remove actions, use the actions filter language. You can modify the shortcuts of actions locally in Preferences->Keymap.

How can I find the source of an action?

There are a few different things that you could try:

  1. Guess. If the caption contains, for example, the text "Clone", search for a root node that has the name Clone in it. Alternatively, you can try searching through the console: #instances<scope = global>(ActionDeclaration).where({~it => it.caption.contains("Clone"); })
  2. Search the MPS GitHub repository: ⧉ for commits or code mentioning your keywords. In this case, the action must be called "CloneModule" based on the first results.
  3. If you find a similar action in the same context menu, check the other actions/groups in the same module. You might have found the groupSolutionRefactoring through the RenameModule ⧉ action, which contains your action.

If the caption is not dynamic, number 1 usually works. Suppose the action is located in the MPS.IDEA module, you will find it in the IntelliJ community sources ⧉.

How can you show modal dialogs for inputting text?

Use the class com.intellij.openapi.ui.Messages ⧉.

How do you add messages to the right side of the window?

In IntelliJ IDEA, it is called an error stripe ⧉. In MPS it is called messages gutter ⧉:

jetbrains.mps.nodeEditor.EditorComponent component = ((EditorComponent) editorContext.getEditorComponent()); 
NodeHighlightManager highlightManager = component.getHighlightManager();

How can you add things to the left of the editor? (examples: breakpoints, go subclasses)

The component is called LeftEditorHighlighter ⧉. Implement a checker to show messages in this component (for example OverrideMethodsChecker ⧉).

How do you add an icon to the status bar?

Look at the implementation of the transient models widget ⧉ and its initialization in TransientModelsNotification ⧉.

What parts of the IntelliJ Platform SDK can't be used in MPS because they are not supported?

Everything related to text files: Documents ⧉, PSI files, Templates ⧉, QuickDoc, IDE Features Trainer, CodeSmellDetector, and Custom Language Support ⧉.

How can you have clickable icons in the left editor margin?

Clickable icons in the left editor margin ⧉ (Specific Languages' blog)

Are there alternatives to message boxes?

Use notification balloons instead of message boxes ⧉ (Specific Languages' blog)

What IDEA UI elements are available?

Polished UI for free: IDEA UI components ⧉ (Specific Languages' blog)

How do you create menu items with checkboxes or combo boxes and make the actions findable?

How can you retrieve all opened windows in split-screen mode ⧉?