Bug 396787 - NullPointerException in ColumnViewerEditor
Summary: NullPointerException in ColumnViewerEditor
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Christoph Laeubrich CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2012-12-17 15:06 EST by Jonathan Jekeli CLA
Modified: 2020-06-15 14:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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