Bug 486163 - Validation of interpreted expression at the level of the color palette might fail because of missing Services
Summary: Validation of interpreted expression at the level of the color palette might ...
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 485136
  Show dependency tree
 
Reported: 2016-01-20 05:44 EST by Cedric Brun CLA
Modified: 2016-11-23 16:13 EST (History)
2 users (show)

See Also:


Attachments
my.project.design Project (5.11 KB, application/zip)
2016-01-26 05:28 EST, Laurent Redor 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 2016-01-20 05:44:11 EST
Steps to reproduce

1- Create a Palette in a VSM with an interpolated color
2- make sure the "Color Value Computation Expression" uses a Java service which is declared in one of the Viewpoints
3- right click-> validate

The editor will complain about the missing service despite the fact that it is declared and imported.

I assume the same bug exists for any color definition which uses interpreted expressions.
Comment 1 Laurent Redor CLA 2016-01-26 05:28:37 EST
Created attachment 259379 [details]
my.project.design  Project

my.project.design.zip: You can also import this project and launch the validation on "MyPalette" of "/my.project.design/description/project.odesign"
Comment 2 Pierre-Charles David CLA 2016-11-23 16:13:28 EST
The root issue is that expression completion/validation is by default tied to the concept of dialect, see DialectManagerImpl.createInterpretedExpressionQuery(EObject, EStructuralFeature). But color palettes and their content are not part of a specific dialect, so we end up using the DefaultInterpretedExpressionQuery, which does not handle them either.

We could make DefaultInterpretedExpressionQuery smarter to know about them, or use the IInterpretedExpressionQueryProvider introduced for properties views (which are not technically a dialect either).

Wherever we put the code, it will be relatively tricky, because it will need to identify (through the cross-referencer) all the "call-sites" where the color is used, and then infer which variables and services are available on all of them. Maybe some kind of recursive call on createInterpretedExpressionQuery on each call site, and an "IntersectionInterpretedExpressionQuery" returning only the results common to all call sites would do the trick.