Editing Class Diagrams

Adding UML elements to a Class Diagram

To add existing UML elements (classes/interfaces) to a Class Diagram:

  1. Open, or set the focus to, the desired Class Diagram.
  2. Select the desired UML element(s) in the Model Explorer.
  3. Either:
    • invoke Edit | Add to Diagram.
      or
    • right-click on the selection and invoke Add to Diagram from the pop up menu.
      Add to Diagram context menu
      or
    • press Ctrl + Alt + Insert.

Removing diagram elements from a Class Diagram

To remove a diagram element (class/interface) from a Class Diagram:

  1. Open, or set the focus to, the desired Class Diagram.
  2. Activate the Selection Tool Selection Tool, it it wasn't already.
  3. Select the desired diagram element(s) in the Class Diagram editor.
  4. Either:
    • invoke Edit | Delete Diagram Element.
      or
    • right-click on the selection and invoke Delete Diagram Element from the pop up menu.
      Delete Diagram Element context menu
      or
    • press Ctrl + Delete.
  5. Confirm the removal from the Class Diagram.
    Delete Diagram Element dialog

Creating new UML elements

To create a new class / interface, use one of the following two methods:

  • Using the Selection Tool Selection Tool:
    1. Open, or set the focus to, the desired Class Diagram.
    2. Activate the Selection Tool Selection Tool, if it wasn't already.
    3. Click somewhere in the empty space of the diagram drawing area.
    4. Either:
      • invoke Edit | New.
        or
      • right-click on the selection and invoke New from the pop up menu.
        New class/interface menu
        or
      • by pressing Alt + Insert.
        New class/interface menu
    5. Choose the new UML element to be created.
  • Using the New Class Tool New Class Tool or New Interface Tool New Interface Tool:
    1. Open, or set the focus to, the desired Class Diagram.
    2. Activate the New Class Tool New Class Tool or New Interface Tool New Interface Tool.
    3. Click somewhere in the empty space of the diagram drawing area.
    4. Enter the new class or interface name.
      New class name dialog
    5. Press OK and the newly created class or interface will show up in the Class Diagram at the position you clicked with the mouse.

To create a new attribute / operation:

  1. Open, or set the focus to, the desired Class Diagram.
  2. Activate the Selection Tool Selection Tool, if it wasn't already.
  3. Select the desired class / interface.
  4. Either:
    • invoke Edit | New.
      or
    • right-click on the selection and invoke New from the pop up menu.
      New attribute/operation menu
      or
    • press Alt + Insert.
      New attribute/operation menu
  5. Choose the new UML element to be created.

To create a new Generalization, Abstraction or Association relationship between two elements:

  1. Open, or set the focus to, the desired Class Diagram.
  2. Activate the New Generalization Tool New Generalization Tool, New Abstraction Tool New Abstraction Tool or New Association Tool New Association Tool.
  3. Hover the mouse over the first class/interface - if the class/interface under the mouse is a valid target for the active tool then a green border will appear surrounding it.
    Green border
  4. Click on the highlighted class/interface to set the subclass/subinterface for the New Generalization Tool New Generalization Tool, implementation class for the New Abstraction Tool New Abstraction Tool or source end for the New Association Tool New Association Tool.
  5. Hover the mouse over the second class/interface - again if the class/interface under the mouse is a valid target for the active tool then a green border will appear surrounding it.
  6. Click on the highlighted class/interface to set the superclass/superinterface for the New Generalization Tool New Generalization Tool, implemented interface for the New Abstraction Tool New Abstraction Tool or target end for the New Association Tool New Association Tool.

Deleting UML elements

To delete a UML element:

  1. Open, or set the focus to, the desired Class Diagram.
  2. Activate the Selection Tool Selection Tool, if it wasn't already.
  3. Select the desired diagram element(s) in the Class Diagram editor.
  4. Either:
    • invoke Edit | Delete.
      or
    • right-click on the selection and invoke Delete from the pop up menu.
      Delete menu
      or
    • press Delete.
  5. Confirm the UML element(s) deletion.
    • If its counterpart exists in source code:
      Safe Delete dialog
    • If its counterpart does not exist in source code (ex., library element):
      Single UML element delete dialog
      Multiple UML element delete dialog

If the UML elements to be deleted have no counterpart in the source code and have dependencies, but not in current selection, (i.e., some other UML element uses it), a dialog will be shown warning about it:
Dependencies Detected dialog