Oleg, there is a huge intersection between what you described below and 
what Paul and I have been discussing but for us we were only thinking at 
the UI level.  We didn't consider POJO injection (but that's cool).  We 
were thinking about hierarchically scoped contexts to parallel visual 
scoping in the workbench (e.g. workbench window, perspective, view stack, 
view), with matching algorithms for getting/setting values.  All this as a 
way to detach those who need the values (e.g. menu enablement) from those 
who supply the values so that the shape of the application can change but 
everything still works. 

Anyway, we should talk... :)

Kevin




Oleg Besedin/Ottawa/i...@ibmca 
Sent by: [email protected]
01/07/2009 03:33 PM
Please respond to
E4 Project developer mailing list <[email protected]>


To
[email protected]
cc

Subject
[e4-dev] A missing framework piece: contexts?







?Progress is made by lazy men looking for easier ways to do things?. 

I think this is exactly how the concept of contexts came to life. Our code 
runs in some environment; way too often we need to pass tens of arguments 
from method to method and from class to class just to keep them aware of 
the environment. 

To make it easier we are considering adding a concept of "context". At the 
conceptual level a "context" is a combination of: 
- a bag that could be stuffed with elements that compose environment, and 
- a mechanism to inject elements from the bag into your POJO objects 

The contexts are organized in a hierarchy. Child context can add service 
objects that make sense at their level: 
        IEquinoxContext  myContext = ApplicationContext.newChild(); 
        myContext.addObject("log", myLog); 

The service objects from the context can be injected into POJO objects 
using field and method injection: 

        myContext.injectInto(object) 

resulting in the field object.equinoxLog being set to "myLog". 

Contexts support dynamic events and multiple service objects per ID. In 
addition, contexts can be tied into creation of objects from the extension 
registry and help access OSGi services. 

I'd like to raise this subject at the E4 call to see what people think 
about it. The details of this work can be found in the enhancement request 
259423: 

https://bugs.eclipse.org/bugs/show_bug.cgi?id=259423 

Sincerely, 
Oleg Besedin _______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev

_______________________________________________
e4-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/e4-dev

Reply via email to