Bug 447729 - Validation of the precondition of a NodeMapping is done with the wrong context type.
Summary: Validation of the precondition of a NodeMapping is done with the wrong contex...
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: 3.0.0M4   Edit
Assignee: Maxime Porhel CLA
QA Contact:
URL:
Whiteboard: trivial, flash, newbie
Keywords: triaged
Depends on:
Blocks: 450473 453056
  Show dependency tree
 
Reported: 2014-10-17 11:36 EDT by Maxime Porhel CLA
Modified: 2014-12-03 03:42 EST (History)
2 users (show)

See Also:


Attachments
viewpoint to reproduce the bug (213.18 KB, image/png)
2014-10-27 05:24 EDT, Fanny Bertrand CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxime Porhel CLA 2014-10-17 11:36:11 EDT
After validating a VSM, I get the following problem:

Description Resource Type Path Location
Invalid Type: viewpoint::DragAndDropTarget My.odesign EMF Problem /fr.obeo.test.mm.design/description Unknown

The validation do not use the correct type as context. The switch used to compute the type must be checked.

Note that completion proposals show thisEObject typed by the mapping domain class: ok



To reproduce: 
. create a diagram description on EPackage
. create all possible mappings: Container, Node, sub Node, bordered nodes with semantic expression: var:self and domainClass: EClass.
. in the mapping precondition fields, use the completion to enter [abstract/]
. Right clic the Viewpoint and select Validate.

Note: additional check should be done with feature:abstract to test another interpreter.

Note: org.eclipse.sirius.diagram.business.internal.dialect.description.DiagramInterpretedExpressionTargetSwitch.caseAbstractNodeMapping(AbstractNodeMapping) seems to correctly handle the precondition case. Check the feature/feaature id computation.
Comment 1 Fanny Bertrand CLA 2014-10-27 05:24:01 EDT
Created attachment 248197 [details]
viewpoint to reproduce the bug

Screen shot of the viewpoint with the properties (General and Advanced)and the Error Log of the container
Comment 2 Fanny Bertrand CLA 2014-10-27 05:30:26 EDT
Hi, 
I think I have the same kind of bug.

I'm trying to migrate my viewpoint form obeodesigner 6.2 to Sirius. I have some acceleo request which used to work on od6.2, but don't work anymore with Sirius.
 
I have a container with a precondition expression. Whatever I put in the precondition expression, I have an error. For exemple, with this request :
 
[thisEObject.isAllocatedByComponent->size()=0/]
 
I have this error :  
 
Compilation error for expression [thisEObject.isAllocatedByComponent->size()=0/] : Invalid Type: viewpoint::DragAndDropTarget
 
The end of the error (Invalid Type: viewpoint::DragAndDropTarget) is always the same, it's not depending on the request.

For reproduce, create a diagram with a container and a precondition expression (see pictures in attachment).
Comment 3 Maxime Porhel CLA 2014-11-06 12:00:45 EST
In diagram.ecore

1 229: <details key="containerView" value="viewpoint.DragAndDropTarget | the view that sould contain the potential views of the checked elements."/>  

The viewpoint.DragAndDropTarget correspond to the qualified name before the metamodel split into viewpoint.ecore and diagram.ecore (Bug 423052 and Bug 427803), the correct qualified name is diagram.DragAndDropTarget.

We have to check the other eAnnotations.
Comment 4 Maxime Porhel CLA 2014-11-07 05:27:04 EST
See https://git.eclipse.org/r/36108 which complete the tests done on the interpreted expression definitions. 


containerView:viewpoint.DragAndDropTarget for description/DiagramElementMapping/preconditionExpression is the only reported type error. 

But I have discovered some other variable potential errors for the accessible packages: several variables diagram:diagram.DDiagram are defined in the interpreted expression of viewpoint.ecore, they should not not reference a metamodel extending the core metamodel. Those expression are only used in the Diagram dialect for the moment but this could be a future issue (I will report a specific bug to track this).
Comment 5 Maxime Porhel CLA 2014-11-07 05:56:15 EST
See https://git.eclipse.org/r/36119 for a correction of the validation issue.
Comment 6 Maxime Porhel CLA 2014-11-19 05:23:08 EST
Correction submitted in commit e85c9b2593010ff337023f5b614b716730c7d001
Comment 7 Pierre-Charles David CLA 2014-11-24 10:04:01 EST
Cloned as bug 453056 to backport for 2.0.2.