Tutorial - JetBrains ZenUML Support

Introduction

ZenUML is a tool allowing users to create UML diagrams from plain text (we call it the ZenUML DSL). With ZenUML DSL, you can create and edit sequence diagrams with ease. Since it auto-generates a sequence diagram from the text you enter, you can focus on more important activities - modelling.

ZenUML Support Jetbrains Plugin recognizes ZenUML files, provides a dedicated editor for them, and shows the rendered HTML in a live preview. The recognised file extensions include: .zen, .z., .zenuml.

The ZenUML editor supports the following syntaxes:

  1. Sending and receiving message, e.g. Alice -> Bob : Hello .

  2. Method call, e.g. BookService.getById(id)

  3. Alternative fragment, e.g. if (condition) { doSomething() }

  4. Loop fragment, e.g. while( i > 0{ doSomething() }

  5. Creation, e.g. A a = new A()

For an full language specification, checkout https://www.zenuml.com/help.html.

You can also use ZenUML DSL to draw sequence diagram online or use the Web Sequence Chrome Extension.

Generate UML from Java Method

Right Click on any Java method, a sequence diagram can be generated from Java code.

Preview 

By default, the ZenUML editor is split into the code editor and the preview pane. If necessary, you can show only the code editor or the preview pane using the View buttons .



You can also manage whether the editor and preview pane are split vertically or horizontally. To do this, open the Settings/Preferences dialog (⌘,), go to the Languages & Frameworks | ZenUML page and use the Editor and Preview Panel Layout option.

Custom CSS for preview 

The ZenUML editor preview allows you to use custom Style Sheets to render a document. You can specify a custom stylesheet to make basic presentation changes (for example, increase the font size in a preview) or you can provide an entirely new CSS (for instance, if your organisation has your own defined style).

To provide custom Style Sheets, open the Settings/Preferences dialog (⌘,), go to the Languages and Frameworks | Markdown page, and set a path to the required CSS file using the Load from URI option. This path can either be a URL or an absolute/relative path.

As an alternative, specify CSS directly in the Add CSS rules editor.



#diagram .sequence-diagram .lifeline .participant { font-weight: 400; border: 2px solid #b94065; background: #fffec8; } #diagram .sequence-diagram .lifeline .participant label { text-decoration: underline; } #diagram .sequence-diagram .lifeline .line { border-left-color: #b94065; } #diagram .sequence-diagram .message { border-bottom-color: #b94065; } #diagram .sequence-diagram .message svg polyline { fill: #b94065; stroke: #b94065; } #diagram .sequence-diagram .message.self svg > polyline:not(.head) { fill: none; } #diagram .sequence-diagram .occurrence { background-color: white; border: 2px solid #b94065; }

Installation and Activation

1. Download and Install the latest version of ZenUML Plugin

Remember “Restart IDE” to complete the installation

2. Add license

Go to menu “Help → Register”

 

Click “Add License”

 

Put in your JetBrains Account and Click “Activate”

 

Once it is activated you should see this: