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

Bug 529092

Summary: Impossible to use a widget action with a selection in a list with an EEF-based dialog
Product: [Modeling] Sirius Reporter: Guillaume Doux <guillaume.doux>
Component: PropertiesAssignee: Project Inbox <sirius.properties-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: guillaume.doux, maxime.porhel, pierre-charles.david, stephane.begaudeau
Version: 5.1.0Keywords: triaged
Target Milestone: 5.1.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on: 529128    
Bug Blocks:    
Attachments:
Description Flags
Reproduction case, based on basic family sample none

Description Guillaume Doux CLA 2017-12-21 09:58:01 EST
Created attachment 272012 [details]
Reproduction case, based on basic family sample

When using a list widget in a EEF-based dialog in Sirius, it is impossible to use a selection (via the "selection" variable with a button (widget action) on the list.

The selection is not preserved when the mouse is released.

The same list widget and action button work perfectly directly in the properties view but not in the dialog
Comment 1 Maxime Porhel CLA 2017-12-22 03:21:03 EST
Thanks for the detailed bug report Guillaume. 

Note that it as not be added to a future release yet.
Comment 2 Stephane Begaudeau CLA 2017-12-22 04:24:51 EST
The issue comes from the fact that dialogs are wired a bit differently in order to react to changes. Since a dialog or a wizard is executed inside of a transaction it is not refreshed in a traditional way since we would have to wait for the transaction opening the dialog/wizard to close to see the changes. The consequence would be that to see a change from a wizard/dialog, we would have to wait until the wizard/dialog is closed. In such situation a widget could not be refreshed by another widget from a dialog/wizard.

To fix this issue, the graphical layer of the wizard/dialogs will automatically trigger a refresh for any kind of change in the wizard/dialog. See org.eclipse.sirius.ui.properties.internal.dialog.PropertiesFormDialog.configureModelChangeRefresh() and more specifically this part:

this.consumer = (status) -> this.refreshDialog();
wrapper.addPerformedModelChangeConsumer(this.consumer);

When you are clicking on a list, it trigger a command which executes the single click or double click tool. Once the tool is executed, it refreshes the dialog/wizards which remove the selection from the list widget.


Since we can't really remove this refresh strategy without creating much bigger issues, we should see why EEListLifecycleManager#refresh removes the selection of the list widget. I think that keeping the current selection in memory and trying to re-select the same elements after the refresh would solve the issue.
Comment 3 Pierre-Charles David CLA 2017-12-22 08:54:12 EST
The fix was merged on the EEF side by bug #529128 and is available in EEF 2.0.1rc1 at http://download.eclipse.org/modeling/emft/eef/updates/milestones/2.0/S201712221253.
Comment 4 Maxime Porhel CLA 2018-01-09 11:13:04 EST
Stéphane, when I clicks on Cancel on the sample dialog, I get the following exception: 

!ENTRY org.eclipse.eef.core 4 0 2018-01-09 17:09:03.850
!MESSAGE An issue has occurred during the evaluation of 'aql:input.executeOperation(self, 'platform:/plugin/org.eclipse.sirius.sample.basicfamily.starter.design/description/basicfamily.odesign#//@extensions.0/@categories.0/@groups.0/@controls.0/@onClickOperation')'.
executeOperation(org.eclipse.sirius.properties.core.api.SiriusInputDescriptor,org.eclipse.emf.ecore.EObject,java.lang.String) with arguments [org.eclipse.sirius.properties.core.api.SiriusInputDescriptor@3b7210ab, Family[TRANSIENT], platform:/plugin/org.eclipse.sirius.sample.basicfamily.starter.design/description/basicfamily.odesign#//@extensions.0/@categories.0/@groups.0/@controls.0/@onClickOperation] failed:
	null

!STACK 0
org.eclipse.acceleo.query.runtime.AcceleoQueryEvaluationException: executeOperation(org.eclipse.sirius.properties.core.api.SiriusInputDescriptor,org.eclipse.emf.ecore.EObject,java.lang.String) with arguments [org.eclipse.sirius.properties.core.api.SiriusInputDescriptor@3b7210ab, Family[TRANSIENT], platform:/plugin/org.eclipse.sirius.sample.basicfamily.starter.design/description/basicfamily.odesign#//@extensions.0/@categories.0/@groups.0/@controls.0/@onClickOperation] failed:
	null
	at org.eclipse.acceleo.query.runtime.impl.AbstractService.invoke(AbstractService.java:147)
	at org.eclipse.acceleo.query.runtime.impl.EvaluationServices.callService(EvaluationServices.java:129)
	at org.eclipse.acceleo.query.runtime.impl.EvaluationServices.call(EvaluationServices.java:172)
	at org.eclipse.acceleo.query.runtime.impl.EvaluationServices.callOrApply(EvaluationServices.java:208)
	at org.eclipse.acceleo.query.parser.AstEvaluator.caseCall(AstEvaluator.java:192)
	at org.eclipse.acceleo.query.ast.util.AstSwitch.doSwitch(AstSwitch.java:119)
	at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
	at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
	at org.eclipse.acceleo.query.parser.AstEvaluator.eval(AstEvaluator.java:112)
	at org.eclipse.acceleo.query.runtime.impl.QueryEvaluationEngine.eval(QueryEvaluationEngine.java:52)
	at org.eclipse.sirius.common.acceleo.aql.business.internal.AQLSiriusInterpreter.evaluateExpression(AQLSiriusInterpreter.java:212)
	at org.eclipse.sirius.tools.internal.interpreter.SessionInterpreter.evaluateExpression(SessionInterpreter.java:151)
	at org.eclipse.sirius.properties.core.api.SiriusInterpreter.evaluateExpression(SiriusInterpreter.java:64)
	at org.eclipse.eef.core.api.utils.EvalFactory$Eval.call(EvalFactory.java:204)
	at org.eclipse.eef.core.api.utils.EvalFactory$Eval.call(EvalFactory.java:181)
	at org.eclipse.eef.core.api.controllers.AbstractEEFOnClickController.lambda$0(AbstractEEFOnClickController.java:58)
	at org.eclipse.sirius.ui.properties.internal.TransactionalEditingDomainContextAdapter$1.doExecute(TransactionalEditingDomainContextAdapter.java:118)
	at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
	at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
	at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
	at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
	at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
	at fr.obeo.dsl.viewpoint.collab.api.editingdomain.NonDirtyingCapableWorkspaceCommandStack.doExecute(NonDirtyingCapableWorkspaceCommandStack.java:68)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
	at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
	at org.eclipse.sirius.ui.properties.internal.TransactionalEditingDomainContextAdapter.performModelChange(TransactionalEditingDomainContextAdapter.java:124)
	at org.eclipse.eef.core.api.controllers.AbstractEEFOnClickController.onClick(AbstractEEFOnClickController.java:50)
	at org.eclipse.eef.ide.ui.api.widgets.EEFTableSelectionListener.triggerOnClick(EEFTableSelectionListener.java:83)
	at org.eclipse.eef.ide.ui.api.widgets.EEFTableSelectionListener.widgetSelected(EEFTableSelectionListener.java:52)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4258)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1502)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1525)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1510)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1314)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4082)
	at org.eclipse.swt.widgets.Display.applicationNextEventMatchingMask(Display.java:5143)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5531)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:228)
	at org.eclipse.swt.widgets.Widget.mouseDownSuper(Widget.java:1136)
	at org.eclipse.swt.widgets.Table.mouseDownSuper(Table.java:2093)
	at org.eclipse.swt.widgets.Widget.mouseDown(Widget.java:1128)
	at org.eclipse.swt.widgets.Control.mouseDown(Control.java:2616)
	at org.eclipse.swt.widgets.Table.mouseDown(Table.java:2064)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5799)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:228)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2148)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2411)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5863)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5291)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5441)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3696)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: org.eclipse.core.runtime.OperationCanceledException
	at org.eclipse.sirius.ui.properties.internal.dialog.DialogTask.lambda$0(DialogTask.java:128)
	at java.util.Optional.ifPresent(Optional.java:159)
	at org.eclipse.sirius.ui.properties.internal.dialog.DialogTask.execute(DialogTask.java:103)
	at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.executeTask(ExecuteToolOperationTask.java:127)
	at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.executeTask(ExecuteToolOperationTask.java:138)
	at org.eclipse.sirius.business.internal.helper.task.ExecuteToolOperationTask.execute(ExecuteToolOperationTask.java:111)
	at org.eclipse.sirius.business.api.helper.task.TaskExecutor.execute(TaskExecutor.java:64)
	at org.eclipse.sirius.tools.api.command.SiriusCommand.doExecute(SiriusCommand.java:80)
	at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
	at org.eclipse.sirius.properties.core.internal.SiriusToolServices.executeOperation(SiriusToolServices.java:69)
	at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.acceleo.query.runtime.impl.JavaMethodService.internalInvoke(JavaMethodService.java:162)
	at org.eclipse.acceleo.query.runtime.impl.AbstractService.invoke(AbstractService.java:135)
	... 79 more
Comment 5 Maxime Porhel CLA 2018-01-09 11:22:31 EST
This might corresponds to Bug 528005. 
Stéphane could you confirm that  ? 
As Guillaume just told me that its use case is corrected by the new version of EEF, we might close this issue.
Comment 6 Guillaume Doux CLA 2018-01-09 11:25:53 EST
I'm with Sirius 5.1.0 and the EEF version of the ticket (2.0.1rc1).
Comment 7 Maxime Porhel CLA 2018-01-10 03:44:03 EST
Validated on Sirius 5.1.1-rc2 + EEF 2.0.1-rc1
Comment 8 Pierre-Charles David CLA 2018-02-01 03:25:36 EST
Available in Sirius 5.1.1. See https://wiki.eclipse.org/Sirius/5.1.1 for details.