eclipsesource / papyrus-gefx

A new Editor kind for Papyrus, based on GEFx and GMF Runtime
0 stars 2 forks source link

[Interactions] Multi-selection policies do not ensure that all selected elements are valid #25

Closed CamilleLetavernier closed 5 years ago

CamilleLetavernier commented 5 years ago

When dragging multiple selected elements, the event is delegated to each individual selected element. That works fine when all selected elements are similar (e.g. all nodes), but causes exceptions when selecting e.g. Nodes + Edges. In that case, the current code tries to move the edges as if they were nodes, which causes exceptions:

java.lang.NullPointerException
    at org.eclipse.papyrus.gef4.gmf.editor.handlers.MoveNodeHandler$1.doExecuteWithResult(MoveNodeHandler.java:80)
    at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
    at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
    [...]
CamilleLetavernier commented 5 years ago

The bug was probably already fixed with #31, but the NPE was still potentially present. The above commit should make sure it won't happen again in the future