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

Bug 571249

Summary: Pb with Copy/Paste format API for Note and Text
Product: [Modeling] Sirius Reporter: Laurent Redor <laurent.redor>
Component: DiagramAssignee: Laurent Redor <laurent.redor>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: glenn.plouhinec, pierre-charles.david
Version: 6.4.0   
Target Milestone: 6.4.2   
Hardware: PC   
OS: Windows 10   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=563117
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/176390
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/176465
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/176506
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=15457c81b870b93bb0a41d85a8b9a3ff186c012d
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=e3e28b46d18eb1d30b4ac01c50b4a5c374b9eb77
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/177296
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/177366
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=ef2d04e958c6cda02fdc3b79910a40c762f8d52f
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=03287238841b5619088ac58bac13afe02212e20e
https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/177408
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=b53ae850b935c382e47a6e72d1858f38a0986205
Whiteboard:
Bug Depends on:    
Bug Blocks: 571287    
Attachments:
Description Flags
SourceAndTargetProjects-571249.zip none

Description Laurent Redor CLA 2021-02-17 05:55:24 EST
The API added in bug 5963117 does not correctly handled existing Note/Text in the target diagram.
A new Node/Text is systematically created, even if a Node/Text already exist in the target diagram (same label and same NoteAttachment target).
Comment 1 Eclipse Genie CLA 2021-02-17 06:21:14 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/176390
Comment 2 Laurent Redor CLA 2021-02-18 02:47:13 EST
Created attachment 285588 [details]
SourceAndTargetProjects-571249.zip

Steps to validate (only in developement env or at least with source of org.eclipse.ui and org.eclipse.diagram.ui in your workspace):
* Apply the patch of bugzilla [563117](https://bugs.eclipse.org/bugs/show_bug.cgi?id=563117)
* Change value, true instead of false, for last parameter of method call of applyFormatOnDiagram line 42 of org.eclipse.sirius.diagram.ui.provider.CopyPasteCommand
* Change value, true instead of false, for last parameter of method call of applyFormatOnNewDiagram line 50 of org.eclipse.sirius.diagram.ui.provider.CopyPasteCommand
* Launch a runtime
* Import projects from SourceAndTargetProjects-571249.zip
* Expand /SourceOfCopy/My.ecore
* Open diagram "DiagType1 of MyPackage"
* Launch the action "Copy Rep" on MyPackage of SourceOfCopy project (action from contextual menu)
* Launch the action "Paste Rep" on MyPackage of SourceOfCopy project (action from contextual menu)
* Expected: A new diagram named "newDiag" is created under MyPackage. Open it. The layout is the same than "DiagType1 of MyPackage" (even for every Notes and Text)
* Delete "newDiag"
* Launch the action "Copy Rep" on MyPackage of SourceOfCopy project (action from contextual menu)
* Expand /TargetOfCopy/My.ecore
* Launch the action "Paste Rep" on MyPackage of TargetOfCopy project (action from contextual menu)
* Expected: The existing diagram "OtherDiag" has been updateds created under MyPackage. Open it. The layout is the same than "DiagType1 of MyPackage" (even for every Notes and Text). Remarks: As the Text "My label" is attach to an element it is not considered as the same Text of "DiagType1 of MyPackage". A new Text is created. That is the expected behavior.
* Delete "OtherDiag"
* Launch the action "Copy Rep" on MyPackage of SourceOfCopy project (action from contextual menu)
* Expand /TargetOfCopy/My.ecore
* Launch the action "Paste Rep" on MyPackage of TargetOfCopy project (action from contextual menu)
* Expected: A new diagram named "newDiag" is created under MyPackage of TargetOfCopy project. Open it. The layout is the same than "DiagType1 of MyPackage" (even for every Notes and Text)
Comment 3 Eclipse Genie CLA 2021-02-18 09:18:38 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/176465
Comment 4 Eclipse Genie CLA 2021-02-19 04:47:21 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/176506
Comment 7 Glenn Plouhinec CLA 2021-03-05 10:05:55 EST
The labels of the Notes are not correctly layouted, they are located at the top of each Note instead of being centered.

Also, this Exception is raised in the first "Copy/Paste" action of the validation scenario:

Unhandled event loop exception

org.eclipse.swt.SWTException: Widget is disposed
	at org.eclipse.swt.SWT.error(SWT.java:4723)
	at org.eclipse.swt.SWT.error(SWT.java:4638)
	at org.eclipse.swt.SWT.error(SWT.java:4609)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:432)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:351)
	at org.eclipse.swt.widgets.Scrollable.getVerticalBar(Scrollable.java:291)
	at org.eclipse.draw2d.FigureCanvas$2.propertyChange(FigureCanvas.java:102)
	at java.desktop/java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:341)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:333)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:266)
	at java.desktop/java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:287)
	at org.eclipse.draw2d.DefaultRangeModel.firePropertyChange(DefaultRangeModel.java:63)
	at org.eclipse.draw2d.DefaultRangeModel.setAll(DefaultRangeModel.java:122)
	at org.eclipse.draw2d.FreeformViewport.readjustScrollBars(FreeformViewport.java:74)
	at org.eclipse.draw2d.Viewport.validate(Viewport.java:381)
	at org.eclipse.draw2d.Figure.validate(Figure.java:1901)
	at org.eclipse.draw2d.DeferredUpdateManager.performValidation(DeferredUpdateManager.java:221)
	at org.eclipse.draw2d.DeferredUpdateManager.performUpdate(DeferredUpdateManager.java:193)
	at org.eclipse.draw2d.DeferredUpdateManager$UpdateRequest.run(DeferredUpdateManager.java:44)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4005)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3633)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1158)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1047)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1420)
Comment 8 Eclipse Genie CLA 2021-03-05 17:02:34 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/177296
Comment 9 Laurent Redor CLA 2021-03-05 17:05:17 EST
The above gerrit is to fix SWTException of comment 7.

The Note alignement problem, in the same comment, seems not linked to this issue (not reproductible for me).
Comment 10 Glenn Plouhinec CLA 2021-03-08 05:49:55 EST
With this patch this is OK on ODCE-11.4.1-RC1: validated with Sirius 6.4.2.
Comment 11 Eclipse Genie CLA 2021-03-08 11:58:16 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/177366
Comment 14 Eclipse Genie CLA 2021-03-09 04:24:37 EST
New Gerrit change created: https://git.eclipse.org/r/c/sirius/org.eclipse.sirius/+/177408
Comment 16 Pierre-Charles David CLA 2021-03-18 04:44:41 EDT
Available in Sirius 6.4.2: http://download.eclipse.org/sirius/updates/releases/6.4.2