You can cut, copy, rename and move elements in the Model Tree window and inside diagrams of the same type. These actions may also be possible across diagrams of different type if applicable. You can also copy or move elements from the Model Tree window into a diagram, provided that the diagram is allowed to contain the corresponding element according to the UML specification.
To rename an element:
|•||Double-click the element name and edit it.|
|•||Alternatively, click the element and press F2.|
The procedures above apply regardless of the window in which the element is displayed, including the Model Tree window, Properties window, and the Diagram window.
The "Root" and "Component View" packages are displayed at all times in the Model Tree window and cannot be renamed or deleted.
To copy or move elements:
|•||Use the standard Windows commands Cut, Copy, or Paste. These commands can be triggered from keyboard shortcuts (Ctrl+X, Ctrl+C, Ctrl+V, respectively), from the corresponding toolbar buttons, as well as from the Edit menu.|
|•||Alternatively, drag an element to a destination package (or element). Dragging an element moves it. Holding down the Ctrl key and dragging an element creates a copy of it.|
For example, in a diagram, you can move a class member to another class by dragging it from the source class to the destination class. To copy the class member rather than moving it, first select it, and then drag it to the destination class while holding down the Ctrl key.
If you paste a class into the same package, the new class is created with a sequential number appended to the end, for example, "MyClass1". Likewise, if you paste a property inside the same class, the new property is created with a sequential number appended to the end, for example, "MyProperty1". The same applies for other class members, such as operations and enumerations. The same logic is also applicable when you paste elements in the same diagram, provided that the diagram belongs to the same package as the elements that are being pasted.
If you paste a class into a different package, the new class will have the same name as the original class. The same logic applies when you copy class members (such as properties, operations, and so on) to a different class.
By default, any element that is pasted into a diagram is automatically added to the model as well (and thus is visible in the Model Tree window). However, you can also copy and paste an element into the current diagram only, without adding it to the model. To do this, first copy the element, right-click on the diagram, and then select Paste in Diagram only from the context menu. The Paste in Diagram only command also appears when you drag an existing item into the same diagram while holding the Ctrl key pressed.
In the example above, Paste will create the new class in the diagram and add it to the model as well, while Paste in Diagram only will only display a second view of it on the diagram. Note that copies created using the second approach are merely additional views of the original element and link to it; they are not standalone copies. (For example, renaming a property in the duplicated class will automatically apply the same change to the original class.)
© 2019 Altova GmbH