| Creation of IEclipseContext [message #986882] |
Thu, 22 November 2012 04:09  |
Dirk Fauth Messages: 524 Registered: July 2012 |
Senior Member |
|
|
Hi,
I have read that it is supported and preferred to create your own IEclipseContext to avoid context variable collisions.
We are thinking of adding DI to NatTable in some kind of way. We are still working on the architecture, so I don't want to start the discussion on how and why here. I just want to gather some information to find the "best" solution.
As NatTable is a complex framework, I thought of creating an IEclipseContext for every NatTable instance itself to avoid variable collisions if you use more than one NatTable in a part.
So there are currently two questions on that:
1. Which is the preferred way to create a new IEclipseContext and add it to the context hierarchy?
I have seen two ways doing this:
public IEclipseContext createContext(IEclipseContext parentContext) {
//Option 1: create by factory and set parent
IEclipseContext context1 = EclipseContextFactory.create();
context1.setParent(parentContext);
//Option 2: create child of parent
IEclipseContext context2 = parentContext.createChild();
...
}
Is there any advantage for one of them?
2. How to tell the classes in NatTable that they should use / are connected to our created context? Do we have to add something there or is this handled by the Eclipse platform itself?
Thanks for your help in advance,
Dirk
|
|
|
|
| Re: Creation of IEclipseContext [message #986924 is a reply to message #986921] |
Thu, 22 November 2012 06:37  |
Dirk Fauth Messages: 524 Registered: July 2012 |
Senior Member |
|
|
Thanks for the quick reply Tom. Yesterday I told my colleagues about ContextInjectionFactory and how it should be used, today I'm asking the same question I answered yesterday. Need holidays!
I guess you mean ContextInjectionFactory.make instead of ContextInjectionFactory.create?
[Updated on: Thu, 22 November 2012 06:49] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01575 seconds