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

Bug 357784

Summary: [modeling] remove all static bridge instances
Product: z_Archived Reporter: Steffen Pingel <steffen.pingel>
Component: MylynAssignee: Miles Parker <milesparker>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: b.muskalla, shawn.minto
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Steffen Pingel CLA 2011-09-15 08:12:21 EDT
Bridges are registered through extension points and their life-cycle is managed by the context framework. Instances should be obtained from the context framework or injected. Creating instances in bridges (e.g. EcoreDiagramUiBridge.getInstance()) can lead to duplicate instances and makes it more difficult to extend and test the implementation.
Comment 1 Miles Parker CLA 2011-09-15 16:04:45 EDT
I spent quite a bit of time trying to discover a way around this issue. This came up somewhere else, I think maybe when discussing packaging. I'd loove to come up with a good solution because as it is now there is a tremendous amount of glue code that is needed in each implementation. I can't say much more until I dive back into this, but IIRC the basic issue has to do with extensibility of the bridges and the fact that both the bridges and the key GMF piece need to be able to coordinate with each other and they're all defined through extensions the life-cycle of which I can't control.

Perhaps I can discover the correct UI and structure bridges from an ID. I'll revisit and look into that.

See also bug 352897 bug 357134
Comment 2 Miles Parker CLA 2011-09-22 16:22:56 EDT
As discussed elsewhere, to do this correctly is going to take a good deal of engineering work and perhaps implicate some larger issues in context core itself. To understand the scope would itself take a fair amount of time. Steffan, if you are happy with the basic implementation now, understanding that it does have limitations, I'm going to suggest that we a) mark this as an enhancement and b) move it out of the initial release dependency.
Comment 3 Steffen Pingel CLA 2011-09-22 17:20:38 EDT
Yes, sounds good. We can revisit this in the future and leave the implementation as is. Just be aware that I have seen instances of UI bridges get created twice: through the getInstance() method and the context framework.
Comment 4 Miles Parker CLA 2011-09-22 19:52:34 EDT
(In reply to comment #3)
> Yes, sounds good. We can revisit this in the future and leave the implementation
> as is. Just be aware that I have seen instances of UI bridges get created twice:
> through the getInstance() method and the context framework.

Right, it's known that we would have two -- the static instance and the instance that the context creator obtains. I don't see how we can avoid that without a good deal of engineering, which now that I have more experience with the context framework I wouldn't mind doing. :)

This shouldn't create any real world problems *as long as the implementation is state-less*. Our implementations are of course, but others following the same pattern may try to add state, which would break. I'll make a note in the DiagramUIBridge class.