Classes in Slime UML

TODO: update for 2.0

Slime UML class shapes are usually attached to an existing class in source code. This class is parsed and displayed in the Class Diagram; the size of the class shape is determined by the size of the text needed to display all methods and attributes.

If you add or delete or change methods or attributes in your class, Slime will automatically update the class diagram. This works instantly; try it; open a diagram with a class on it, e.g. Viewport. Then open the source code and start typing a new method. Instantly the new method will pop up on the diagram:

Detached Classes

New in this version are detached classes; you can add classes to the diagram without having source code; such a class is detached and you can edit attributes, methods and class name as described here. A detached class is displayed by Slime, but has no semantics; thus you can enter arbitrary text into the compartment and you will not be able to generate anything from it (yet) !

The preferred way to work with Slime is by dragging existing classes to a diagram.

Classes without Source Code

You can add .class-files (e.g. from a jar) to a diagram as well; this does even work with drag&drop, but you can use "Diagram->Add Classes" too.

Filtering Attributes/Methods

For classes you can filter, which attributes/methods should be shown. There are several ways to do this.

The class diagram preferences look like this:


For the other methods, you need to select the classes to change first. Since you can work with multiple selections, like most of the time in Slime UML, what happens if you select 3 classes which already show methods, and two which don't?

Easy; if there are more classes selected which show methods already than methods which don't, after selecting "Diagram->Show/Hide Class..->Methods" all selected classes won't show methods. ALT+M is a shortcut for this.

Move/Rename of Classes

If you move or rename classes, Slime loses track of the source code. The class is disassociated and displayed the last text it knew. You can fix it by removing the class from the diagram and adding the moved/renamed one. But all your carefully added associations will be lost.

Another method is to select the class, open the properties window and change the associated class name to the new name; the property is "Misc->associated Class". Take care that you enter the fully qualified class name, otherwise it won't work.

Browsing the Source Code

If you double-click on a method or attribute of a class shape, an editor opens and positions you at the attribute or method. This only works with class shapes created from source code, not for .class or detached classes.

New since v0.9 is the Source Browser View.

Open it using Window --> Show View --> Other --> Slime UML Diagram --> Source Browser. Then select the Source Browser Tool from the toolbar (arrow with a green C) and click on a method in the diagram. The source browser view immediately shows the corresponding source. This even works for .class files with attached source code !

Remark: This is a view only; you cannot edit the displayed code. To edit code, use double-click to open Java Editor.