Bug 518228

Summary: Undo of creation of waypoints does not restore selection handles
Product: [Tools] GEF Reporter: Victor Johnsson <victor.johnsson>
Component: GEF MVCAssignee: gef-inbox <gef-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: matthias.wienand
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
How to reproduce the bug none

Description Victor Johnsson CLA 2017-06-14 05:51:24 EDT
Created attachment 268901 [details]
How to reproduce the bug

This bug was reproduced in the GEF logo example integration release 5.0.0.201706100201.

Steps to reproduce:
1. Create new waypoint for some connection by dragging a white bend point.
2. Undo action

Expected: The visual bend points are restored.
Actual: The end visual bend point has disappeared.
Comment 1 Matthias Wienand CLA 2017-06-14 11:12:39 EDT
It is important to clarify the terminology of "bend points" and "handles": content and visual bend points represent (connected or unconnected) way points of an IBendableContentPart or its visual, respectively. Within the GEF Logo Example, circular handles are generated for all bend points when a GeometricCurvePart is selected. The handles can be used to manipulate the underlying bend points.

In this case, the bend point is correctly restored. Only the handle that can be used to manipulate that bend point is not restored. I changed the title accordingly.

Updating of (selection) handles during interaction is done via SelectionBehavior#updateHandles(). This call is not performed when undoing the operation. Hence, the handles are not up-to-date after undo.

Probably, the SelectionBehavior should be able to identify that an update is necessary and perform it automatically.

As a fix will not be released until Oxygen.1 (although most certainly published way earlier on the master branch), the following workaround can be used in the interim: you can construct a ForwardUndoCompositeOperation that wraps a BendVisualOperation, as well as a special operation for updating the handles, so that they are updated after every execution/undo of the visual bend points.