Bug 465300 - OperationAction might have a "diagram" variable at runtime which is not available at specification time
Summary: OperationAction might have a "diagram" variable at runtime which is not avail...
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0.0M7   Edit
Assignee: Project inbox CLA
QA Contact: Belqassim Djafer CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 462490
  Show dependency tree
 
Reported: 2015-04-23 09:46 EDT by Cedric Brun CLA
Modified: 2015-06-24 11:17 EDT (History)
1 user (show)

See Also:


Attachments
Test VSM to reproduce the issue (846 bytes, application/zip)
2015-04-24 04:21 EDT, 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 Cedric Brun CLA 2015-04-23 09:46:28 EDT
Steps to reproduce :

Create a VSM with an OperationAction
in the implementation add a "browse" model operation with var:diagram
right click and validate
=> You get an error stating the current context has no "diagram" variable accessible

Yet in 
UndoRedoCapableEMFCommandFactory.buildOperationActionFromTool(OperationAction, EObject, Collection<DSemanticDecorator>)

We have the following code :

  DSemanticDecorator firstContainerView = null;
        if (containerViews != null && containerViews.size() > 0) {
            firstContainerView = containerViews.iterator().next();
            addDiagramVariable(result, firstContainerView, interpreter);
        }

which is declaring the "diagram" variable if any there are containerViews.
Comment 1 Cedric Brun CLA 2015-04-23 09:48:04 EDT
For reference:  you can also reproduce this problem by validating the "Design" viewpoint which is part of ecore.odesign in EcoreTools
Comment 2 Pierre-Charles David CLA 2015-04-24 04:21:28 EDT
Created attachment 252711 [details]
Test VSM to reproduce the issue

Confirmed on current master with the attached VSM.
Comment 3 Cedric Brun CLA 2015-04-24 05:53:06 EDT
The "not so clean" part is that OperationAction is defined in viewpoint.ecore which is not supposed to know about "diagram" and that such operation can be defined within the context of Tree representation for instance. That means defining it as *accessible* in viewpoint.ecore is wrong, but making sure it is available in the code completion and validation based on the current structure of the VSM is the best option.
Comment 4 Eclipse Genie CLA 2015-04-24 06:04:01 EDT
New Gerrit change created: https://git.eclipse.org/r/46406
Comment 6 Cedric Brun CLA 2015-04-27 08:09:35 EDT
Fixed for M7.
Comment 7 Belqassim Djafer CLA 2015-05-22 09:34:26 EDT
Verified with Sirius 3.0.0 RC1
Comment 8 Pierre-Charles David CLA 2015-06-24 11:17:06 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.