Attributes and operations can be added to classes and interfaces in a UML class diagram, and to associations by using association classes. Attributes can also be added to data types. Literals can be added to enumerations in a class diagram.

New attributes, operations, and literals can be added in different ways. There is a regular way via the Create pane. You just click the concept you want to add, and then select the element in the diagram where you want to place it. Or you use the quick-create pop-up window: In the diagram, click in the white area of the element, briefly hold down the mouse button, and in the appearing pop-up window click the element you want to add.

Steps:

  1. In the diagram, select the element, and then click  on the element. The color of the control depends on the type of the item.



  2. Press F2, type the name of the attribute, operation, or literal, and press Enter.


The attributes, operations, and literals are automatically placed below each other within their own section in the element:


Attributes and operations in a class


If you do not want the attributes, operations or literals to be shown in their element, you can hide them. Just click the element, and then click the control. The color of the control depends on the type of the item. By clicking the control one more time you can make the items visible again.


Controls for hiding/showing attributes and operations