Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 486330

Summary: Prevent interpreted expression evaluation on DRepresentation whose Viewpoint is not enabled
Product: [Modeling] Sirius Reporter: Esteban DUGUEPEROUX <esteban.dugueperoux>
Component: CoreAssignee: Project inbox <sirius.core-inbox>
Status: CLOSED FIXED QA Contact: Maxime Porhel <maxime.porhel>
Severity: normal    
Priority: P3 CC: laurent.redor, max.schettler, maxime.porhel, pierre-charles.david
Version: 3.1.0Keywords: triaged
Target Milestone: 4.0.0M7   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/65688
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=2baba6572dfa7a4b6614402373286ac29d51de65
https://git.eclipse.org/r/66028
https://git.eclipse.org/r/66099
https://git.eclipse.org/r/66101
https://git.eclipse.org/r/66107
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3fb910f89d0f60ebc3c61323ca5962ac86efe1e1
https://git.eclipse.org/r/66110
https://git.eclipse.org/r/66117
https://git.eclipse.org/r/66120
https://git.eclipse.org/r/66136
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=9c6ba432ec9c65571e493f715cf277587096b383
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=9f09a3e78375e1eab510bb92364cd9f357b7afcd
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=725366169ddbb98bf9ea3d3fe7c353622db0e2a2
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=1a5b1d6864a513df73ff680db3e53122c780b466
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=92d285df85281ff155e8101c19091d196269d5e3
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=3dbdc21d199b8d98e00bfa83dccb62b7637beded
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=d462f5445529a04e9f33e9631a029cb4021b20c5
https://git.eclipse.org/r/66510
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ad1e732e67182121d4dee188e330fd3f92cc8f10
https://git.eclipse.org/r/69986
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=8023bbc4832f9bec64d94e91d0e583676ed91cf2
Whiteboard:

Description Esteban DUGUEPEROUX CLA 2016-01-22 05:20:46 EST
Using AQL as interpreted expression on DRepresentation, we must be sure to have associated Viewpoint activated to have the associated metamodels registered in AQL interpreter to avoid potential evaluation issues.

Then we should add check in operations doing interpreted expression evaluation to ensure of that.

For example we RefreshRepresentationsCommand could do this check in its canExecute() method. This could be done also in DialectManager.INSTANCE.refresh() if called directly.
CreateRepresentationCommand also could do the check in addition to DialectManager.INSTANCE.createRepresentation().

And perhaps in other places.
Comment 1 Esteban DUGUEPEROUX CLA 2016-01-22 05:33:25 EST
Scenario to reproduce:

1. Create a session with a semantic resource
2. Select a Viewpoint from a modeler to work on this semantic
3. Create a representation
4. Have a mean to refresh this representation, the default Sirius UI don't propose that which is normal but the API don't prevent it.
Comment 2 Laurent Redor CLA 2016-01-27 11:38:08 EST
The best would be to have a junit test to reproduce this problem. A step misses in the above scenario:

1. Create a session with a semantic resource
2. Select a Viewpoint from a modeler to work on this semantic
3. Create a representation
4. Deselect the Viewpoint
5. Have a mean to refresh this representation, the default Sirius UI don't propose that which is normal but the API don't prevent it.
Comment 3 Eclipse Genie CLA 2016-02-02 09:45:30 EST
New Gerrit change created: https://git.eclipse.org/r/65688
Comment 5 Eclipse Genie CLA 2016-02-05 10:48:05 EST
New Gerrit change created: https://git.eclipse.org/r/66028
Comment 6 Eclipse Genie CLA 2016-02-08 04:20:15 EST
New Gerrit change created: https://git.eclipse.org/r/66099
Comment 7 Eclipse Genie CLA 2016-02-08 04:40:40 EST
New Gerrit change created: https://git.eclipse.org/r/66101
Comment 8 Eclipse Genie CLA 2016-02-08 05:18:52 EST
New Gerrit change created: https://git.eclipse.org/r/66107
Comment 10 Eclipse Genie CLA 2016-02-08 05:52:20 EST
New Gerrit change created: https://git.eclipse.org/r/66110
Comment 11 Eclipse Genie CLA 2016-02-08 08:51:08 EST
New Gerrit change created: https://git.eclipse.org/r/66117
Comment 12 Eclipse Genie CLA 2016-02-08 09:25:39 EST
New Gerrit change created: https://git.eclipse.org/r/66120
Comment 13 Eclipse Genie CLA 2016-02-08 10:49:56 EST
New Gerrit change created: https://git.eclipse.org/r/66136
Comment 21 Eclipse Genie CLA 2016-02-12 10:53:56 EST
New Gerrit change created: https://git.eclipse.org/r/66510
Comment 23 Laurent Fasani CLA 2016-03-01 05:26:07 EST
*** Bug 475390 has been marked as a duplicate of this bug. ***
Comment 24 Esteban DUGUEPEROUX CLA 2016-03-21 06:28:30 EDT
RAF:

DialectServices and AbstractRepresentationDialectServices has been changed to check Viewpoint selection requirement.
Now it remains to have RefreshRepresentationsCommand.canExecute() check DialectManager.canRefresh() to be coherent with the call to DialectManager.canCreate() in CreateRepresentationCommand.canExecute().
Comment 25 Eclipse Genie CLA 2016-04-06 03:39:13 EDT
New Gerrit change created: https://git.eclipse.org/r/69986
Comment 27 Laurent Redor CLA 2016-04-25 09:56:21 EDT
According to comment 24 and contents of the last commit, this issue is fixed.
Comment 28 Maxime Porhel CLA 2016-05-24 10:47:35 EDT
Validated on Sirius 4.0.0.201605180923 (4.0.0 RC1)
Comment 29 Pierre-Charles David CLA 2016-06-24 08:03:29 EDT
Available in Sirius 4.0.0.