Bug 489270 - Problem with "Move operation" in Operation Action
Summary: Problem with "Move operation" in Operation Action
Status: CLOSED INVALID
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-03-09 04:57 EST by Julien Dupont CLA
Modified: 2016-03-25 10:25 EDT (History)
1 user (show)

See Also:


Attachments
Example to reproduce problem with Move operation (8.99 KB, application/zip)
2016-03-09 04:57 EST, Julien Dupont CLA
no flags Details
The fixed VSM (7.82 KB, application/octet-stream)
2016-03-09 05:53 EST, Pierre-Charles David CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Dupont CLA 2016-03-09 04:57:42 EST
Created attachment 260172 [details]
Example to reproduce problem with Move operation

In attached example we have 2 examples of Move operation. One worked and other none.
The example doesn't work is the Operation Action named ClassToPackageSelected. 
This example generate a NullPointerException.

To reproduce problem use example attached:
- Open NewDiagramEcore
- Select package named "p1"
- Right Click on this package Move ClassToPackageSelected
- Select EClass named "E22"
-> NullPointerException! Ko!
Comment 1 Pierre-Charles David CLA 2016-03-09 05:50:51 EST
Closing as invalid, because with a few tweaks in the VSM it works fine (see the attached VSM), but I'll open a separate issue for the underlying useability issue, which is that when the Sirius runtime expects an AQL expression to return an EObject, and it returns an EObject wrapped into a collection, the Sirius/AQL bridge returns null instead of the more natural behavior of unwrapping the element.
Comment 2 Pierre-Charles David CLA 2016-03-09 05:53:10 EST
Created attachment 260176 [details]
The fixed VSM

Two changes compared to the first version:
* aql:views.target was changed into aql:views.target->first() to explicitly unwrap the (singleton) collection and return a plain EObject as expected
* added a "Change Context" to var:classToMove, as otherwise the tool tried to move the EPackage into itself.