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

Bug 519117

Summary: Layout data flush due to dialog model operation
Product: [Modeling] Sirius Reporter: Melanie Bats <melanie.bats>
Component: DiagramAssignee: Pierre-Charles David <pierre-charles.david>
Status: CLOSED FIXED QA Contact: Julien Dupont <julien.dupont>
Severity: normal    
Priority: P2 CC: julien.dupont, pierre-charles.david
Version: 5.0.0Keywords: triaged
Target Milestone: 5.1.0   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/100589
https://git.eclipse.org/r/103776
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=a769a57844001a171b5b8b944e0fff0c1e53c293
Whiteboard: backport
Bug Depends on:    
Bug Blocks: 519278    
Attachments:
Description Flags
Sample project to reproduce the issue none

Description Melanie Bats CLA 2017-07-03 11:32:13 EDT
In my odesign, I defined a creation tool which calls a dialog to propose to the end user to set some values on the newly created element.

I clicked on the tool from the palette and then select the diagram, the dialog opens, if no values are edited in the dialog, the element is created where I had clicked.
If I update some values in the dialog, then the element is not created where I clicked but somewhere else in the diagram.

After having a look on debug this seems to be due to a flush of the layout data due to the recording command executions done by the dialog. See the following stacktrace for details: 

Thread [main] (Suspended)	
	SiriusLayoutDataManagerImpl.flushRootLayoutDatas() line: 849	
	SiriusLayoutDataFlusher.historyNotification(OperationHistoryEvent) line: 53	
	DefaultOperationHistory$2.run() line: 870	
	SafeRunner.run(ISafeRunnable) line: 42	
	DefaultOperationHistory.notifyListeners(OperationHistoryEvent) line: 859	
	DefaultOperationHistory.notifyDone(IUndoableOperation) line: 925	
	DefaultOperationHistory.execute(IUndoableOperation, IProgressMonitor, IAdaptable) line: 504	
	WorkspaceCommandStackImpl.doExecute(Command, Map<?,?>) line: 208	
	WorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command, Map<?,?>) line: 165	
	WorkspaceCommandStackImpl(AbstractTransactionalCommandStack).execute(Command) line: 219	
	TransactionalEditingDomainContextAdapter.performModelChange(Runnable) line: 124	
	EditingContextAdapterWrapper.performModelChange(Runnable) line: 56	
	EEFCheckboxController.updateValue(boolean) line: 67	
	EEFCheckboxLifecycleManager.lambda$1(SelectionEvent) line: 165	
	331286548.accept(Object) line: not available	
	SWTUtils$1.widgetSelected(SelectionEvent) line: 54	
	TypedListener.handleEvent(Event) line: 249	
	EventTable.sendEvent(Event) line: 84	
	Display.sendEvent(EventTable, Event) line: 5227	
	Button(Widget).sendEvent(Event) line: 1340	
	Display.runDeferredEvents() line: 4561	
	Display.readAndDispatch() line: 4151	
	PropertiesFormDialog(Window).runEventLoop(Shell) line: 818	
	PropertiesFormDialog(Window).open() line: 794	
	DialogTask.lambda$0(SiriusInputDescriptor, IVariableManager, SiriusInterpreter, DialogModelOperation) line: 125	
	1545609928.accept(Object) line: not available	
	Optional<T>.ifPresent(Consumer<? super T>) line: 159	
	DialogTask.execute() line: 103	
	ExecuteToolOperationTask.executeTask(ICommandTask, CommandContext) line: 127	
	ExecuteToolOperationTask.executeTask(ICommandTask, CommandContext) line: 138	
	ExecuteToolOperationTask.executeTask(ICommandTask, CommandContext) line: 138	
	ExecuteToolOperationTask.executeTask(ICommandTask, CommandContext) line: 138	
	ExecuteToolOperationTask.execute() line: 111	
	TaskExecutor.execute(List<ICommandTask>) line: 64	
	SiriusCommand.doExecute() line: 80	
	SiriusCommand(RecordingCommand).execute() line: 135	
	GMFCommandWrapper.doExecuteWithResult(IProgressMonitor, IAdaptable) line: 102	
	GMFCommandWrapper(AbstractTransactionalCommand).doExecute(IProgressMonitor, IAdaptable) line: 247	
	GMFCommandWrapper(AbstractEMFOperation).execute(IProgressMonitor, IAdaptable) line: 150	
	CompositeCommand.doExecuteWithResult(IProgressMonitor, IAdaptable) line: 403	
	CompositeCommand(AbstractCommand).execute(IProgressMonitor, IAdaptable) line: 134	
	WrappingCommandIgnoringAffectedFiles.execute(IProgressMonitor, IAdaptable) line: 124	
	DefaultOperationHistory.execute(IUndoableOperation, IProgressMonitor, IAdaptable) line: 488	
	DDiagramCommandStack.execute(ICommand, IProgressMonitor) line: 71	
	DDiagramCommandStack.execute(Command, IProgressMonitor) line: 52	
	DDiagramCommandStack(DiagramCommandStack).execute(Command) line: 156	
	CreationTool(AbstractTool).executeCommand(Command) line: 425	
	CreationTool(AbstractTool).executeCurrentCommand() line: 438	
	CreationTool(CreationTool).performCreation(int) line: 269	
	CreationTool(CreationTool).handleButtonUp(int) line: 189	
	CreationTool(AbstractTool).mouseUp(MouseEvent, EditPartViewer) line: 1200	
	DiagramEditDomain(EditDomain).mouseUp(MouseEvent, EditPartViewer) line: 301	
	DomainEventDispatcher.dispatchMouseReleased(MouseEvent) line: 380	
	LightweightSystem$EventHandler.mouseUp(MouseEvent) line: 548	
	TypedListener.handleEvent(Event) line: 221	
	EventTable.sendEvent(Event) line: 84	
	Display.sendEvent(EventTable, Event) line: 5227	
	FigureCanvas(Widget).sendEvent(Event) line: 1340	
	Display.runDeferredEvents() line: 4561	
	Display.readAndDispatch() line: 4151	
	PartRenderingEngine$4.run() line: 1121	
	Realm.runWithDefault(Realm, Runnable) line: 336	
	PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 1022	
	E4Workbench.createAndRunUI(MApplicationElement) line: 150	
	Workbench$5.run() line: 693	
	Realm.runWithDefault(Realm, Runnable) line: 336	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 610	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 148	
	IDEApplication.start(IApplicationContext) line: 138	
	EclipseAppHandle.run(Object) line: 196	
	EclipseAppLauncher.runApplication(Object) line: 134	
	EclipseAppLauncher.start(Object) line: 104	
	EclipseStarter.run(Object) line: 388	
	EclipseStarter.run(String[], Runnable) line: 243	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 62	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 498	
	Main.invokeFramework(String[], URL[]) line: 673	
	Main.basicRun(String[]) line: 610	
	Main.run(String[]) line: 1519	
	Main.main(String[]) line: 1492
Comment 1 Pierre-Charles David CLA 2017-07-03 11:42:27 EDT
Created attachment 269172 [details]
Sample project to reproduce the issue

Steps to reproduce:
1. Import the attached project.
2. Open the session and the single (empty) diagram in it.
3. Invoke the "Class" tool from the palette on a point in the center of the view area. When the dialog opens, DO NOT edit anything but click OK immediatly. The new class appears at the correct location, where the tool was invoked => OK.
4. Invoke the "Class" tool again, this time pointing to another location, say on the lower right of the view area. When the dialog appears, toggle the "Abstract" checkbox (for example) before hitting OK. The new class appears in the top-left corner of the diagram (the default location), nowhere near where the tool was invoked => KO.
Comment 2 Eclipse Genie CLA 2017-07-04 03:02:43 EDT
New Gerrit change created: https://git.eclipse.org/r/100589
Comment 3 Eclipse Genie CLA 2017-08-28 11:02:35 EDT
New Gerrit change created: https://git.eclipse.org/r/103776
Comment 5 Pierre-Charles David CLA 2017-08-31 09:52:48 EDT
Fixed by a769a57844001a171b5b8b944e0fff0c1e53c293.
Comment 6 Pierre-Charles David CLA 2017-11-08 03:37:21 EST
Available in Sirius 5.1.0, see https://wiki.eclipse.org/Sirius/5.1.0.