| Summary: | Add ability to uninject without specific context | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Oleg Besedin <ob1.eclipse> | ||||||||||
| Component: | E4 | Assignee: | Project Inbox <e4.runtime-inbox> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||
| Severity: | enhancement | ||||||||||||
| Priority: | P3 | CC: | emoffatt, ob1.eclipse, pwebster, remy.suen | ||||||||||
| Version: | unspecified | ||||||||||||
| Target Milestone: | --- | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Bug Depends on: | |||||||||||||
| Bug Blocks: | 318026 | ||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Oleg Besedin
Created attachment 172458 [details]
Patch
+ Added:
ContextInjectionFactory#make(clazz, IEclipseContext context, IEclipseContext staticContext)
- values from the staticContext override values from the context
- changes to values injected from the staticContext are not tracked
- disposal or GC of the staticContext does not affect injected object
- the context is considered to be injected into the object, uninject / disposal will of the context will affect the object
+ Changed #uninject() to call @PreDestroy
+ For completness, added similar invokation method:
ContextInjectionFactory#invoke(object, qualifier, context, localContext, defaultValue)
=====
How to use:
IEclipseContext localContext = EclipseContextFactory.create();
localContext.set("abc", "myValue");
object = ContextInjectionFactory.make(class, context, localContext);
This allows passing extra non-tracked values that are not present in the "real" context.
Patch appled to CVS Head. Created attachment 172794 [details]
Patch to IContributionFactory
One more change: make the new functionality available in the IContributionFactory.
Patch "Patch to IContributionFactory" applied to CVS Head. The patch makes new method vissible via IContributionFactory. Created attachment 172996 [details]
Patch to place the 'uninvoke' behavior into the PRE
To test this just start an inner with a new WS, minimize a stack an right-click on the perspective in the switcher and choose 'reset'.
Re-opening... Created attachment 173006 [details]
Patch for the CCE
Patch applied to CVS Head. |