Editing a class diagram
The actions available for editing a class diagram include the following. Further editing options can be found under Editor.
Adding a new element
- 1. Open the Tools window via the View menu.
- 2. Select an element in the Tools view and drag & drop it onto the opened class diagram. Drop it in a suitable location to visualize it there.
- The new element is created in the project tree and shown in the diagram.
Deselect “Toolbox” view
- An element is selected in the Toolbox window. In the editor the cursor has the form of the selected element.
- 1. Press the right mouse button.
- The element is deselected, and the standard Pointer element is selected.
Editing identifiers
- 1. Open the line editor of an identifier with two single clicks.
- 2. Enter a new name and confirm it via the [Enter] key or by clicking in an empty area of the diagram.
- The identifier has the new name.
Visualize existing element from the project tree on the diagram
- 1. Select an element of type POU, INTERFACE, GVL or DUT in the project tree and drag & drop it onto the opened class diagram. Drop it in a suitable location to visualize it there.
- The corresponding element is shown in the diagram. If relationships with already shown elements exist, these are displayed automatically.
Cross-references
The class element, which has a relationship with the selected element but is not included in the class diagram, is shown in the Toolbox window under the heading Incoming cross references or Outgoing cross references. First, the relationship type that links the two elements is shown as a symbol. This is followed by the name of the target or source element. You can drag and drop the element onto the diagram, so that the element is shown in the class diagram.
Showing cross-references
- 1. Open the Toolbox window via the View menu.
- 2. Select a rectangle element in the opened class diagram, which has relationships that are not shown in the class diagram.
- Under Toolbox the relationships with the elements are listed, which are not yet shown in the class diagram. Under Incoming cross references missing incoming relationships with source elements are listed. Under Outgoing cross references missing outgoing relationships are listed, together with target elements.
Visualize existing element from the cross-references on the diagram
- 1. Drag & drop the element, which is listed under Incoming cross references or Outgoing cross references and which is to be shown in the diagram, onto the class diagram. Drop it in a suitable location to visualize it there.
- The corresponding element is shown in the diagram. The relationships with the already shown elements are displayed automatically.
Generate relationship between diagram elements
Option 1 – via icon:
- 1. Select an element in the opened class diagram.
- 2. Click on a relationship icon, which appears above the element (the selected element acts as source element).
- 3. Click on the target element of the selected relationship.
- You have created a relationship between the source and target element, which is active in the project and shown in the diagram.
Option 2 – via Toolbox:
- 1. Click on a relationship element from Toolbox.
- 2. In the opened class diagram first click on the source element, then on the target element.
- You have created a relationship between the source and target element, which is active in the project and shown in the diagram.
Removing an element from the diagram
Option 1 – via icon:
- 1. Select the element in the class diagram, which you want to remove from the diagram.
- 2. Use the icon Remove from diagram, which appears above the element.
- The selected element is removed from the diagram.
Option 2 – via the [Del] key
- 1. Select the element in the class diagram, which you want to remove from the diagram.
- 2. Press the [Del] key.
If the option Show prompt when deleting objects from diagram is disabled, the object is only deleted from the diagram by default.
If the option is enabled, select the option “Remove from diagram” in the dialog that opens.
- The selected element is removed from the diagram.
Removing an element from the diagram and the project
Option 1 – via icon:
- 1. Select the element in the class diagram, which you want to remove from the diagram and the project.
- 2. Use the icon Remove from project and diagram, which appears above the element.
- The selected element is removed from the diagram and the project.
Option 2 – via the [Del] key
- 1. Enable the option Show prompt when deleting objects from diagram.
- 2. Select the element in the class diagram, which you want to remove from the diagram and the project.
- 3. Press the [Del] key and select the option Remove from project and diagram in the dialog that opens.
- The selected element is removed from the diagram and the project.
As project navigator
- 1. Open a class diagram and double-click on an element in the class diagram.
- The editor pertaining to the element opens.
- 2. If necessary, you can edit the declaration and implementation in the opened editor as usual.
- Any changes of the declaration are automatically updated in the class diagram.
Multiple selections
- If Pointer is enabled in Toolbox (default), you can drag a rectangle over several elements in the class diagram while pressing the left mouse button. All elements covered by the rectangle are then selected.
- Multiple selections are also possible by successively selecting the required elements while pressing the [Ctrl] key.
- [Ctrl+A] or Select all selects all the elements within a rectangle, but no relationship elements.
Refactoring
The following changes, which are made in the class diagram editor, can be applied simply to the complete project by refactoring:
- Renaming of variables, function blocks or properties
- Addition and removal of variables of the type VAR_INPUT, VAR_OUTPUT or VAR_IN_OUT
By default, the Refactoring functionality and the associated preview (Refactoring dialog) is activated in the class diagram. However, this can be restricted using the following options dialogs:
- Dialog: Options – PLC environment - Refactoring – UML class diagram
- Dialog: Options – PLC environment – UML – Class diagram
Note above all that the preview dialog can be skipped in the options for the UML class diagram and that in this case the change will be applied project-wide without requesting confirmation.