| Summary: | NPE in SaveHandler | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] e4 | Reporter: | Paul Webster <pwebster> | ||||||||
| Component: | UI | Assignee: | Oleg Besedin <ob1.eclipse> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | bokowski, ob1.eclipse, remy.suen | ||||||||
| Version: | 1.0 | Flags: | pwebster:
review+
bokowski: review+ |
||||||||
| Target Milestone: | 1.0 RC3 | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Paul Webster
Created attachment 170684 [details]
Add canExecute call to MenuItemRenderer
I added enablement to the MenuItem renderer and then launched a clean 4.0 SDK.
PW
The "null" is a valid value in the context; if a "null" value is set in the context, it will be used in injection.
In this case ActivePartLookupFunction sets the value of "e4ActivePart" to "null" due to the following code:
window = (MContext) context.get(MApplication.class.getName());
if (window == null) {
return null;
}
The value is used when invoking SaveHandler's
canExecute(@Named(IServiceConstants.ACTIVE_PART) MDirtyable dirtyable)
I'm seeing this exact same behaviour for the first time too. Created attachment 170861 [details]
Possible patch
One possible solution is to have IContextFunction return IInjector.NOT_A_VALUE instead of null.
(In reply to comment #4) > Possible patch By the way, that only going to work if consumers are never supposed to see active part being null. What about a workbench window with no open perspectives? I think that *should* result in 'activePart' == null... Created attachment 174888 [details]
Javadoc patch
So, null is a valid value for the IServiceConstants.ACTIVE_PART.
(From the context/DI side, there is a difference between "null" value and no value. In general, "null" is a valid value for a variable and, if set, will be injected.)
I've looked at all references to the ACTIVE_PART in SDK and they all seem to properly react to null values in the ACTIVE_PART.
The only change needed is a Javadoc change specifying that "null" is a valid value for the IServiceConstants.ACTIVE_PART.
Boris, Paul, can you review? The change is only in Javadoc, might as well do it now. Fixed in CVS Head. |