eclipse-capella / capella

Open Source Solution for Model-Based Systems Engineering
https://mbse-capella.org
Eclipse Public License 2.0
229 stars 94 forks source link

NameCollisionHelper does not play well with EAdapters pre-emptively resolving name collisions #2821

Open flatombe opened 6 months ago

flatombe commented 6 months ago

In org.polarsys.capella.core.platform.sirius.ui.commands.CapellaPasteCommand.doExecute(), first the command is performed, which means EAdapters can intervene and possibly update the name of an element being added (to prevent name collisions for instance). Then the Capella name collision check is performed via org.polarsys.capella.core.platform.sirius.ui.commands.NameCollisionHelper.isCollide(Collection<?>, String), but it searches for collisions by iterating through all the contents of the parent element, meaning that a collision is always found.

Instead, there should only be collisions to handle if the element that just got pasted really has the same name as its origin.