Bug 545533 - Pb with collapsed region compartment with edges
Summary: Pb with collapsed region compartment with edges
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Diagram (show other bugs)
Version: 6.1.0   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 6.1.3   Edit
Assignee: Laurent Redor CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks: 545594
  Show dependency tree
 
Reported: 2019-03-19 04:54 EDT by Laurent Redor CLA
Modified: 2019-06-17 10:47 EDT (History)
3 users (show)

See Also:


Attachments
edgePointingToInvisibleNode.png (770.60 KB, image/png)
2019-03-19 04:54 EDT, Laurent Redor CLA
no flags Details
DesignerTestProject.zip (273.34 KB, application/x-zip-compressed)
2019-03-19 04:55 EDT, Laurent Redor CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent Redor CLA 2019-03-19 04:54:15 EDT
Created attachment 277922 [details]
edgePointingToInvisibleNode.png

With collapsed compartment, it is possible, in some cases, to have edge visible even if source or target is not visible. This causes to have an edge drawn from or to nowhere as in "edgePointingToInvisibleNode.png"

Steps to reproduce:
* Import the projet "DesignerTestProject" (from DesignerTestProject.zip): This project is a copy of data contained in "/org.eclipse.sirius.tests.junit/data/unit/compartments" but completed for this case
* Open the diagram "regionWithEdges"
* Collapse the "region" of "Center_p4" container (select it and click on the "-" button)
* The edge from "Left_p3" and "newPackage1" disappears: OK.
* Save the session
* Export this diagram as png image using "Export diagram as image" button from the tabbar
* Open the exported image
* The edge is visible in the exported image: KO
* Move the container "Left_p3"
* The edge appears: KO
* Move the container "Center_p4"
* The edge disappears: OK

This problem has been detected in Sirius 6.1.0. But it probably exists since the addition of the compartments.
Comment 1 Laurent Redor CLA 2019-03-19 04:55:12 EDT
Created attachment 277923 [details]
DesignerTestProject.zip
Comment 2 Laurent Redor CLA 2019-03-19 10:51:01 EDT
Explanation for the Export as image case
----------------------------------------

In the GMF mechanism, in case of collapse of compartment, the edge is firstly "painted" and it is then hidden in asyncExec because of the the method org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart.refreshConnections(). For example, at the diagram opening, we have this stack:

Thread [main] (Suspended (breakpoint at line 614 in org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart))	
	owns: org.eclipse.swt.widgets.RunnableLock  (id=14479)	
	org.eclipse.sirius.diagram.ui.internal.edit.parts.DNodeContainerViewNodeContainerCompartmentEditPart(org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart).forceRefreshConnections() line: 614	
	org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart$2.run() line: 598	
	org.eclipse.swt.widgets.RunnableLock.run(org.eclipse.swt.widgets.Display) line: 37	
	org.eclipse.ui.internal.UISynchronizer(org.eclipse.swt.widgets.Synchronizer).runAsyncMessages(boolean) line: 182	
	org.eclipse.swt.widgets.Display.runAsyncMessages(boolean) line: 4213	
	org.eclipse.swt.widgets.Display.readAndDispatch() line: 3820	
	org.eclipse.jface.operation.ModalContext$ModalContextThread.block() line: 165	
	org.eclipse.jface.operation.ModalContext.run(org.eclipse.jface.operation.IRunnableWithProgress, boolean, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.swt.widgets.Display) line: 369	
	org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog).run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress) line: 483	
	org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress) line: 237	
	org.eclipse.ui.internal.progress.ProgressManager.run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress) line: 989	
	org.eclipse.sirius.ui.tools.internal.actions.session.OpenRepresentationsAction.run() line: 80	
	org.eclipse.sirius.ui.tools.internal.views.common.navigator.OpenEditorDoubleClickListener.openRepresentations(java.util.Set<org.eclipse.sirius.viewpoint.DRepresentationDescriptor>) line: 81	
	org.eclipse.sirius.ui.tools.internal.views.common.navigator.OpenEditorDoubleClickListener.doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) line: 67	

So during the opening, a readAndDispatch() is called on the UIThread to execute, among others, the refresh of the connections from the ShapeCompartmentEditPart code.

But when we export the diagram as image, a new instance of the diagram is created and there is no readAndDispatch(). The edge remain visible.
The fix will consist of calling readAndDispatch() before creating the image.
Comment 3 Laurent Redor CLA 2019-03-19 12:08:53 EDT
Explanation for the problem when the source or the target is moved
------------------------------------------------------------------

By default, GMF does not consider edges on ContainerEditPart, parent of the ShapeCompartmentEditPart, during the refreshConnections mechanism of the ShapeCompartmentEditPart (org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart.refreshConnections()). But in Sirius, it is possible to have
such.
The fix will consist of considering the edges pointing to ContainerEditPart (as source or as target), parent of the ShapeCompartmentEditPart, in the refreshConnections mechanism.
Comment 4 Eclipse Genie CLA 2019-03-19 12:15:36 EDT
New Gerrit change created: https://git.eclipse.org/r/139043
Comment 5 Eclipse Genie CLA 2019-03-19 12:15:38 EDT
New Gerrit change created: https://git.eclipse.org/r/139042
Comment 6 Eclipse Genie CLA 2019-03-19 12:15:39 EDT
New Gerrit change created: https://git.eclipse.org/r/139044
Comment 7 Eclipse Genie CLA 2019-03-20 04:56:41 EDT
New Gerrit change created: https://git.eclipse.org/r/139093
Comment 12 Laurent Redor CLA 2019-03-20 12:14:03 EDT
Steps to validate:
* All "steps to reproduce" from the description must be OK.
Comment 13 Jerome Pequery CLA 2019-05-28 05:17:54 EDT
Validated with T4C 1.3.1 it5
Comment 14 Pierre-Charles David CLA 2019-06-17 10:47:03 EDT
Available in Sirius 6.1.3, see https://wiki.eclipse.org/Sirius/6.1.3