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

Bug 509941

Summary: Deselecting a connection with orthogonal routing locks the Logo example
Product: [Tools] GEF Reporter: Victor Johnsson <victor.johnsson>
Component: GEF MVCAssignee: Matthias Wienand <matthias.wienand>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.wienand, victor.johnsson
Version: unspecified   
Target Milestone: 5.0.0 (Oxygen) M5   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
How to replicate the bug none

Description Victor Johnsson CLA 2017-01-04 11:25:31 EST
Created attachment 266118 [details]
How to replicate the bug

Deselecting a connection with orthogonal routing that is a part of a group selection locks the Logo ui example.

The attached gif shows the replication steps, which are:
 1. Change to orthogonal routing for a connection
 2. Create a group selection of a connection and a shape using Ctrl + Left Mouse to add to selection.
 3. Deselect the connection using Ctrl + Left Mouse

Result: The Logo ui example is rendered unusable. Cannot move, resize, delete or create parts.

Done with the GEF integration release 5.0.0.201612310303.
Comment 1 Matthias Wienand CLA 2017-01-05 07:13:33 EST
Thank you for the valueable report. I suspect an error within SelectionBehavior, HoverBehavior, or AbstractBehavior, and will look into the issue ASAP.
Comment 2 Victor Johnsson CLA 2017-01-10 10:40:46 EST
This may be related to Bug 510195
Comment 3 Matthias Wienand CLA 2017-01-11 13:20:09 EST
I did not yet find the main problem, but resolved two corresponding issues while looking into the issue:
 - Added a null check within SelectionBehavior#updateHandles(), so that updateHandles() can be called for targets which do not currently have handles. This mitigates the issue on my system, so that the application is still usable, although handles and feedback are in an invalid state.
 - Added a preservedHandlePart#refreshVisual() call within SelectionBehavior#updateHandles() for all preserved handle parts, so that the preserved circle handle part at the start of the connection does not change its color to blue, but instead stays red.

The code is published on the master branch, therefore, I would be grateful if you could verify that the application is not drawn completely unusable with these fixes when trying to reproduce it.

There is also an independent problem with the multi selection bounds: if a connection does not have free bend points, the origin (0, 0) is included in the multi selection bounds (added bug #510296).
Comment 4 Victor Johnsson CLA 2017-01-12 02:58:38 EST
I can verify that the application does not become locked as before. But as you said, handles remain even though the connection is no longer selected. When selecting the connection again, an exception is thrown but it does not affect the general usability of the application:

java.lang.IllegalStateException: Handles were already added for the given set of target parts.
	at org.eclipse.gef.mvc.fx.behaviors.AbstractBehavior.addHandles(AbstractBehavior.java:221)
	at org.eclipse.gef.mvc.fx.behaviors.AbstractBehavior.addHandles(AbstractBehavior.java:195)
	at org.eclipse.gef.mvc.fx.behaviors.SelectionBehavior.addFeedbackAndHandles(SelectionBehavior.java:82)
	at org.eclipse.gef.mvc.fx.behaviors.SelectionBehavior$1.onChanged(SelectionBehavior.java:61)
	...

Bug 510195 is affected in the same way, the application does not become locked as before.
Comment 5 Matthias Wienand CLA 2017-01-13 10:09:54 EST
I ensured that AbstractBehavior#updateHandles() does only recompute the handle parts for a given set of target parts if there are already handle parts present for that set of target parts. Prior, the #updateHandles() method was called by BendOnSegmentDragPolicy#endDrag() when deselecting the curve from the multi selection, which led to a creation of selection handles for the curve. Later on, when selection handles for the curve should really have been created, the behavior failed, because handles were already present.

The code is published on the master branch, therefore, I resolve this ticket as fixed for 5.0.0 M5. If you still encounter related problems, feel free to reopen this ticket.