[UI] Improve pasting a copied model element multiple times
- When a copied model element is pasted in a diagram for the first time (e.g., a component in a component diagram), the following measures are taken to help the user to distinguish the original from the copy
- Element is copied with an offset (see #2344)
- The prefix "Copy of" is prepended to the name of the original
- However, when the same copied element is pasted another time, it is positioned at exactly the same position as the first copy (thanks to #2344, the name is included a suffix to distinguish the first and the second copy)
- The double offset is applied again to the second copy, i.e. the relative position of the second to the first copy is the same as the one of the first copy to the original
- This results in a stacked view of all pasted copies, growing to the bottom-right
#2 Updated by Anonymous over 4 years ago
the class org.fortiss.tooling.kernel.ui.util.CopyPasteUtils deals with the copy&paste functionality.
Paste is done from "clipboard", and the name of the object is changed in this class only, but the node is moved by the compositor (of the object). I can see 2 ways in which this issue could be solved,
1) after pasting change the contents of the clipboard and replace the object in the clipboard by the "pasted object".
2) In the compositor somehow find out if there is an object at that offset in the container, if yes then further change the offset.
I prefer the first one, but I understand that a change in kernel is not desired.