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

Bug 499100

Summary: Scoped instances are not reused correctly because the scope is switched after instance creation.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF CommonAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.0.0   
Target Milestone: 4.1.0 (Neon.1) RC1   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2016-08-03 09:06:25 EDT
Currently, adapters that are scoped to an IAdaptable are reused even though the IAdaptable changes, because the scope for the IAdaptable is switched after the adapters were already created. For example, two viewers will share a SelectionModel and a HoverModel, even though these models are scoped per viewer instance.

In order to resolve this issue, we should ensure that the scopes are switched before injecting adapters.
Comment 1 Matthias Wienand CLA 2016-08-09 05:46:31 EDT
I implemented switching of adaptable scopes when adapters are injected, or rather right before adapters are injected, within AdapterInjector. Consequently, I removed the enter(), leave() and switchAdaptableScopes() calls from the behavior, viewer, domain, and visual-part classes. The code is published on the master branch and was ported back to R4_0_maintenance. Therefore, I resolve this ticket as fixed for 4.1.0 RC1 / 5.0.0 M1.