| Summary: | Get rid of org.eclipse.e4.services extension point | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | John Arthorne <john.arthorne> | ||||||
| Component: | UI | Assignee: | John Arthorne <john.arthorne> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | bokowski, ob1.eclipse | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 0.9 M4 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
John Arthorne
I've been chipping away at this for a few months, but I'm nearly done. Created attachment 139813 [details]
Fix
I was able to remove most users of the services extension point by simply registering OSGi services instead. However, there were a few remaining cases where something extra was needed:
- In some cases we want a factory that returns a different value on each lookup
- In some cases we want to use information in the context to help us supply a service value (e.g., EContextService)
These cases are supported in this patch by allowing bundles to declare IContextFunction instances as services. A service property specifies the "key" to be used when adding that function to a context. The OSGiContextStrategy consults context function services during its lookup. Adding support for this literally took three lines of code!
Created attachment 139814 [details]
Test cases
Adding some test cases that use declaratively registered context functions. This gives true lazy activation because the DS component will only be activated when the service is obtained.
Released to head. Also released: - Fixed e4photo demo to use DS component rather than services extension point. Lazy activation strictly needed here, but I wanted a simple "best practices" example of how to combine all the pieces in the demo. - Removed code in e4.ui.workbench that seeded the main context with functions defined by services extension point. |