| Summary: | Edge creation with its border nodes: difference between feedback and result | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Laurent Redor <laurent.redor> | ||||||||||
| Component: | Diagram | Assignee: | Laurent Redor <laurent.redor> | ||||||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | florian.barbin, maxime.porhel | ||||||||||
| Version: | 2.0.0 | Keywords: | triaged | ||||||||||
| Target Milestone: | 3.1.0 | ||||||||||||
| Hardware: | PC | ||||||||||||
| OS: | Linux | ||||||||||||
| See Also: |
https://git.eclipse.org/r/51757 https://git.eclipse.org/r/51759 https://git.eclipse.org/r/53383 https://git.eclipse.org/r/53382 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=08d4a2628b1b9e7f01d4f18635168f07e0b7e4e9 https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=d5f85c079265745f40f599aee3689c611768ec68 |
||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 254752 [details]
edgeCreationFeedback.png
Created attachment 254753 [details]
edgeCreationResult.png
Technical analysis: The feedback is shown by org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy.showCreationFeedback(CreateConnectionRequest). The command is build through org.eclipse.sirius.diagram.ui.graphical.edit.policies.SiriusGraphicalNodeEditPolicy.buildSiriusConnectionCreationCmd(CreateConnectionRequest). The feedback figure is straightened by the router that consider a "margin" for that (org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor.STRAIGHT_LINE_TOLERANCE used indirectly in org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter.resetEndPointsToEdge(Connection, PointList) during the showCreationFeedback). But the command is build from the data of the request (that currently completely ignores the magic of the router). The SiriusGraphicalNodeEditPolicy used to build the command has not access to the feedback. Indeed, the feedback is created by the SiriusGraphicalNodeEditPolicy of the source of the edge and the command is build by the SiriusGraphicalNodeEditPolicy of the target of the edge. Created attachment 254871 [details]
borderedNode.zip
In fact, the problem is the same without the border nodes. I updated the use case.
Steps to reproduce:
* Import the project "borderedNode" from borderedNode.zip (this data has been inspired from /org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode).
* Open the diagram "diagWithEdgeOnBorderNode" from this project
* Check that:
** The snap to grid is enabled
** The grid spacing is set to 2 pixels
* Use the tool "Reference" from "C1", point {650, 205}, to "C2", point {659, 307}. The feedback is straight, but the result is an oblique edge.
Here is the status of my current analysis. I'm in holiday until the 31/07/2015 so I cannot finalize this bug. 1- The source feedback is shown (but with a deffered update for the figure) *******org.eclipse.sirius.diagram.ui.tools.internal.part.SiriusDiagramGraphicalViewer$ToggleUpdateManager.sendUpdateRequest(SiriusDiagramGraphicalViewer.java:176) org.eclipse.draw2d.DeferredUpdateManager.queueWork(DeferredUpdateManager.java:247) org.eclipse.sirius.diagram.ui.tools.internal.part.SiriusDiagramGraphicalViewer$ToggleUpdateManager.queueWork(SiriusDiagramGraphicalViewer.java:285) org.eclipse.draw2d.DeferredUpdateManager.addInvalidFigure(DeferredUpdateManager.java:133) org.eclipse.draw2d.Figure.revalidate(Figure.java:1448) org.eclipse.draw2d.Figure.revalidate(Figure.java:1450) org.eclipse.draw2d.Figure.revalidate(Figure.java:1450) org.eclipse.draw2d.Figure.revalidate(Figure.java:1450) org.eclipse.draw2d.Figure.revalidate(Figure.java:1450) org.eclipse.draw2d.PolylineConnection.revalidate(PolylineConnection.java:224) org.eclipse.draw2d.PolylineConnection.setTargetAnchor(PolylineConnection.java:314) org.eclipse.gef.editpolicies.FeedbackHelper.setAnchor(FeedbackHelper.java:85) org.eclipse.gef.editpolicies.FeedbackHelper.update(FeedbackHelper.java:99) ******org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy.showCreationFeedback(GraphicalNodeEditPolicy.java:287) org.eclipse.sirius.diagram.ui.graphical.edit.policies.SiriusGraphicalNodeEditPolicy.showCreationFeedback(SiriusGraphicalNodeEditPolicy.java:1395) org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy.showSourceFeedback(GraphicalNodeEditPolicy.java:298) org.eclipse.gef.editparts.AbstractEditPart.showSourceFeedback(AbstractEditPart.java:1093) org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart.showSourceFeedback(GraphicalEditPart.java:1380) ******org.eclipse.gef.tools.AbstractConnectionCreationTool.showSourceFeedback(AbstractConnectionCreationTool.java:377) org.eclipse.gef.tools.AbstractConnectionCreationTool.handleMove(AbstractConnectionCreationTool.java:319) 2- The target feedback is shown and the command is constructed (but not always with the real data about edge feedback because of the deffered update of the figure) org.eclipse.sirius.diagram.ui.graphical.edit.policies.SiriusGraphicalNodeEditPolicy.buildSiriusConnectionCreationCmd(CreateConnectionRequest) org.eclipse.sirius.diagram.ui.graphical.edit.policies.SiriusGraphicalNodeEditPolicy.getConnectionCompleteCommand(SiriusGraphicalNodeEditPolicy.java:708) ... ******org.eclipse.gef.tools.AbstractConnectionCreationTool.showTargetFeedback(AbstractConnectionCreationTool.java:377) org.eclipse.gef.tools.AbstractConnectionCreationTool.handleMove(AbstractConnectionCreationTool.java:319) 3-The edge feedback is really drawn org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor.normalizeToStraightlineTolerance(Point, Point, int) ... org.eclipse.gmf.runtime.draw2d.ui.internal.routers.RouterHelper.resetEndPointsToEdge(RouterHelper.java:479) org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter.resetEndPointsToEdge(ObliqueRouter.java:997) org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter.routeLine(ObliqueRouter.java:502) org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter.routeBendpoints(ObliqueRouter.java:210) org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ObliqueRouter.route(ObliqueRouter.java:195) org.eclipse.draw2d.AutomaticRouter.route(AutomaticRouter.java:151) org.eclipse.gmf.runtime.draw2d.ui.internal.routers.FanRouter.routeBendpoints(FanRouter.java:55) org.eclipse.gmf.runtime.draw2d.ui.internal.routers.FanRouter.route(FanRouter.java:39) org.eclipse.draw2d.PolylineConnection.layout(PolylineConnection.java:176) org.eclipse.draw2d.Figure.validate(Figure.java:1896) org.eclipse.draw2d.Figure.validate(Figure.java:1898) ... After this analysis, the only solution that I imagine is to pass the figure to the request in ExtendedMetaData. And compute the EdgeLayoutData from this edge only during the execution of the command. At this moment, the feedback figure will be the last one (after deffered update). But I did not think this is a "clean solution". New Gerrit change created: https://git.eclipse.org/r/51757 The above gerrit corresponds to my analysis of comment 6. New Gerrit change created: https://git.eclipse.org/r/51759 I finally quickly tried the solution with edge figure passes to the request. It seems to work... Do not hesitate to comment the above gerrit. New Gerrit change created: https://git.eclipse.org/r/53383 New Gerrit change created: https://git.eclipse.org/r/53382 Gerrit change https://git.eclipse.org/r/53382 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=08d4a2628b1b9e7f01d4f18635168f07e0b7e4e9 Gerrit change https://git.eclipse.org/r/53383 was merged to [master]. Commit: http://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=d5f85c079265745f40f599aee3689c611768ec68 Resolved with above commits. Verified with 3.1.0.201509211006 Available in Sirius 3.1.0. |
Created attachment 254751 [details] borderedNode.zip When we create an edge with its associated border nodes, there is sometimes a difference between the feedback and the result. Steps to reproduce: * Import the project "borderedNode" from borderedNode.zip (this data has been inspired from /org.eclipse.sirius.tests.swtbot/data/unit/tools/creation/borderedNode). * Open the diagram "diagWithEdgeOnBorderNode" from this project * Check that: ** The snap to grid is enabled ** The grid spacing is set to 2 pixels * Use the tool "Create 2 inherited interfaces" from "P5-2", point {150, 205}, to "P5-3", point {160, 306}. The feedback is straight (edgeCreationFeedback.png), but the result is an oblique edge (edgeCreationResul.png).