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

Bug 486477

Summary: Provide convenience method for disregarding event processing when a more specific target part can be found.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF MVCAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.2.0   
Target Milestone: 4.0.0 / 3.11.0 (Neon) M5   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2016-01-25 09:44:14 EST
The AbstractInteractionPolicy should provide a method to determine if the policy is the most specific policy that can process the event, or if there is another, more specific policy, that will also process the event. Such a filter mechanism is necessary, because multiple policies can be active simultaneously. The mechanism is already implemented within a number of interaction policies: FXFocusAndSelectOnClickPolicy, FXHoverOnHoverPolicy, OpenParentGraphOnDoubleClickPolicy.
Comment 1 Matthias Wienand CLA 2016-01-26 07:31:52 EST
As the filter mechanism is JavaFX-specific, I created an AbstractFXInteractionPolicy that provides two convenience methods #isRegistered(EventTarget) and #isRegisteredForHost(EventTarget). These convenience methods are now used within the interaction policies that need filtering. For example, the FXHoverOnHoverPolicy is guarded as follows:

public void hover(MouseEvent e) {
	// do nothing in case there is an explicit event target
	if (isRegistered(e.getTarget()) &amp;&amp; !isRegisteredForHost(e.getTarget())) {
		return;
	}
	// ...
}

The code is published on the master branch, therefore, I resolve this ticket as fixed for 3.11.0M5.