Bug 522434

Summary: Acceleo 3 expressions are not interpreted when used in properties widgets
Product: [Modeling] Sirius Reporter: Pierre Guilet <pierre.guilet>
Component: PropertiesAssignee: Project Inbox <sirius.properties-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: florian.barbin, niels.brouwers
Version: 5.0.0Keywords: triaged
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
project to reproduce
none
project to reproduce none

Description Pierre Guilet CLA 2017-09-18 10:52:58 EDT
Created attachment 270244 [details]
project to reproduce

When an Acceleo 3 expression ['test'/] is used in a widget like the text one for value or label expression for example, the expression is not taken into account and the property widget does not show the result of the expression without showing any log explaining why.

The problem is the following: 

Status WARNING: org.eclipse.acceleo.parser code=1 Problems encountered while compiling expression null children=[Status WARNING: org.eclipse.acceleo.parser code=0 A variable should not be named 'self'. This name is an Acceleo or OCL keyword. null]

The problem seems to lie in org.eclipse.sirius.common.acceleo.mtl.business.internal.interpreter.AcceleoMTLInterpreter.createCompilationContext(EObject, String)

The created compilation context contains the self variable that seems to be forbidden by the acceleo interpreter:

The stack leading to this variable setting is the following:

AcceleoMTLInterpreter.setVariable(String, Object) line: 880	
	SessionInterpreter.setVariable(String, Object) line: 389	
	SiriusInterpreter.declareLocals(Map<String,Object>, IInterpreter) line: 86	
	SiriusInterpreter.setupInterpreter(Map<String,Object>) line: 79	
	SiriusInterpreter.evaluateExpression(Map<String,Object>, String) line: 63	
	EvalFactory$Eval<TYPE>.call(String, Consumer<TYPE>) line: 204	
	EEFViewImpl.initialize() line: 129	
	EEFViewFactory.createEEFView(EEFViewDescription, IVariableManager, IInterpreter, EditingContextAdapter, IEEFDomainClassTester, InputDescriptor) line: 66	
	SiriusTabDescriptorProvider.createEEFView(Session, SiriusInputDescriptor, EEFViewDescription) line: 100	
	SiriusTabDescriptorProvider.getTabDescriptors(Session, SiriusInputDescriptor, List<PageDescription>) line: 90	
	SiriusTabDescriptorProvider.getTabDescriptors(SiriusInputDescriptor) line: 85	
	SiriusTabDescriptorProvider.get(IWorkbenchPart, ISelection, IEEFTabbedPropertySheetPageContributor) line: 68	
	EEFTabbedPropertyRegistry.getAllTabDescriptors(IWorkbenchPart, ISelection) line: 81	
	EEFTabbedPropertyRegistry.getTabDescriptors(IWorkbenchPart, ISelection) line: 123	
	EEFTabbedPropertySheetPage.doSetInput(IWorkbenchPart, ISelection) line: 310	
	EEFTabbedPropertySheetPage.setInput(IWorkbenchPart, ISelection) line: 256	
	EEFTabbedPropertySheetPage.selectionChanged(IWorkbenchPart, ISelection) line: 239	

Steps to reproduce:
1- import the attached project.
2-open the "new root" diagram
3-select the EClass

The properties view contains the widget MyWidget that is empty whereas the label of the EClass that is "test" comes from the same A3 expression used in style label. 

4-change the text widget value A3 expression by aql:'test'

MyWidget has the "test" value.
Comment 1 Pierre Guilet CLA 2017-09-18 10:58:16 EDT
Created attachment 270245 [details]
project to reproduce
Comment 2 Florian Barbin CLA 2017-09-28 11:13:21 EDT
Issue reproduced with the given test case. Marked as triaged.