Bug 396787

Summary: NullPointerException in ColumnViewerEditor
Product: [Eclipse Project] Platform Reporter: Jonathan Jekeli <jon.jekeli>
Component: UIAssignee: Christoph Laeubrich <laeubi>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: ivan, laeubi
Version: 4.2.1Keywords: needinfo
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Jonathan Jekeli CLA 2012-12-17 15:06:53 EST
Not certain what version of jface I am using (I am in eclipse Juno using eclipse rcp 4.2.1).  I created a custom jface.DialogCellEditor. In ColumnViewerEditor.activateCellEditor, there is the following code (lines 198-210):

~~~
// Tricky flow of control here:
// activate() can trigger callback to cellEditorListener which
// will clear cellEditor
// so must get control first, but must still call activate()
// even if there is no control.
final Control control = cellEditor.getControl();
cellEditor.activate(activationEvent);
if (control == null) {
    return false;
}
setLayoutData(cellEditor.getLayoutData());
setEditor(control, (Item) cell.getItem(), cell.getColumnIndex());
cellEditor.setFocus();
~~~

From the comment, it is clear that it is known that the activate() call can change cellEditor to null.  In my case (cellEditor is the custom DialogCellEditor), it does, and as a result I get a NullPointerException on setLayoutData(cellEditor.getLayoutData());

This starts from a programmatic activation of the cell using ColumnViewer.editElement()

I can post code if necessary.  This NPE doesn't seem to affect anything on the surface, but I am worried there might be some behind the scenes stuff affected.

Thanks.
Comment 1 Ivan Furnadjiev CLA 2012-12-19 01:12:06 EST
Which RAP version are you using? Please attach a self-running snippet to reproduce the problem.
Comment 2 Jonathan Jekeli CLA 2012-12-20 08:10:59 EST
Hmm I just realized I placed this in the wrong place. I misread the Product: RAP as Product: RCP. Would the best place to move this be Product: Platform and Component: UI?

(In reply to comment #1)
> Which RAP version are you using? Please attach a self-running snippet to
> reproduce the problem.
Comment 3 Ivan Furnadjiev CLA 2012-12-20 08:20:00 EST
(In reply to comment #2)
> Hmm I just realized I placed this in the wrong place. I misread the Product:
> RAP as Product: RCP. Would the best place to move this be Product: Platform
> and Component: UI?
> 
> (In reply to comment #1)
> > Which RAP version are you using? Please attach a self-running snippet to
> > reproduce the problem.

I think Platform -> JFace