Community
Participate
Working Groups
It could be great to have a copy operation with the paste operation in the odesign to specify what elements we want to copy and not just the DDiagramElement and DDiagramElement.getTarget. For example, DDiagramElement.getTarget references could be copied too.
The current behavior was a compromise with less flexibility to ensure more safety, in particular leaks when copy/pasting across different editing domains. But I agree it should be possible to be more open/configurable here. It looks like the behavior in question is mostly isolated in SiriusClipboardGlobalActionHandler.getCopyCommand(), and in particular in extractDSelection() and extractSemanticSelection(). extractSemanticSelection() in particular could be more configurable than just taking each DSemanticDecorator's target. Maybe mappings could have an additional interpreted expression (somewhat similar to "Additional Semantic Elements") to return other elements than just the target to include in the copy. Would that solve your use case?
yes, that solve it.
Adding Maxime in CC, as he's the most knowledgeable in this area of Sirius and may have remarks on the solution I propose.
Note that if we start to interpret user-supplied expressions inside getCopyCommand(), the actual copying code should be transfered during the command's execution, not during getCopyCommand() as it is right now, or it will slow down the whole diagram usage as soon as the selection contains a significant number of elements.