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

Bug 312421

Summary: Contexts need to have a name
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P3 CC: ob1.eclipse
Version: 1.0   
Target Milestone: 1.0 M6   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2010-05-11 09:28:30 EDT
Seeing "Anonymous Context" everywhere isn't helping anyone. I'll make some tweaks in the renderer.
Comment 1 Remy Suen CLA 2010-05-11 09:34:54 EDT
Fixed in CVS HEAD.
Comment 2 Oleg Besedin CLA 2010-05-11 09:43:38 EDT
Do you think it will make sense to remove EclipseContextFactory#create() and leave only EclipseContextFactory#create(String name) ?
Comment 3 Remy Suen CLA 2010-05-11 10:39:17 EDT
(In reply to comment #2)
> Do you think it will make sense to remove EclipseContextFactory#create() and
> leave only EclipseContextFactory#create(String name) ?

But then we can't be lazy in our tests. ;)

In all honesty, I think it should be canned.
Comment 4 John Arthorne CLA 2010-05-11 15:46:13 EDT
Sigh. See bug 264899. We originally required a name when creating contexts, but in an effort to make it easier to use, I removed it and instead introduced a context value (IContextConstants.DEBUG_STRING). This made the name optional for those who didn't really need it, but more importantly it allowed the debug string to contain information that was computed from other information in the context (by storing a function instead of a field in that property). You don't always know a good name for a context at the time you create it, but there might be a particular property in the context that helps to identify it. I.e., imagine Object.toString() was a field instead of a method, and you had to supply it at the moment the object was constructed. It would be much less useful as a debugging tool.

But, I see now that in bug 292766 Oleg removed this concept and reintroduced a static name at creation time (also in an attempt to make contexts easier to use ;) Oleg, do you think having a toString function isn't useful or you just found that we weren't making much use of it?
Comment 5 Oleg Besedin CLA 2010-05-11 16:10:28 EDT
(In reply to comment #4)
> But, I see now that in bug 292766 Oleg removed this concept and reintroduced a
> static name at creation time (also in an attempt to make contexts easier to use
> ;) Oleg, do you think having a toString function isn't useful or you just found
> that we weren't making much use of it?

The implementation did not change in the bug 292766; we still use DEBUG_STRING variable to store the name. The OSGi context still provides the override. What changed is that we don't expose it as an API anymore as it was not used by the rest of e4. Should our comrades demand this functionality, we can always make it an API.