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

Bug 154289

Summary: [Viewers] - NPE in TreeEditorImpl.activateCellEditor
Product: [Eclipse Project] Platform Reporter: Susan McCourt <susan>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P2 CC: tom.schindl
Version: 3.2Keywords: helpwanted
Target Milestone: 3.3 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Make setViewerColumn private to Class
none
EditorValue not saved
none
Fix NLP and editor value appling
none
Fix noneditable Columns in BookmarkView none

Description Susan McCourt CLA 2006-08-17 15:42:29 EDT
I'm running I20060816-1200, WinXP with the latest org.eclipse.jface from HEAD.
If I run an Eclipse workbench from this configuration, I see the following problem in the self-hosted workspace (but not in an unmodified I20060816.)  It started to appear when I first updated my workspace with all the new viewer API:

- Open the bookmark view
- Add a bookmark to some resource
- Edit the bookmark's description in the bookmark view using the cell editor

Problem:
- the bookmark description doesn't update
- the following NPE appears in the log

!ENTRY org.eclipse.ui 4 0 2006-08-17 10:12:12.020
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
	at org.eclipse.jface.viewers.TreeEditorImpl.activateCellEditor(TreeEditorImpl.java:75)
	at org.eclipse.jface.viewers.TreeEditorImpl.activateCellEditor(TreeEditorImpl.java:143)
	at org.eclipse.jface.viewers.TreeEditorImpl.handleMouseDown(TreeEditorImpl.java:279)
	at org.eclipse.jface.viewers.TreeViewer$1.mouseDown(TreeViewer.java:355)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:133)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3377)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2997)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)

I get the same NPE if I try to edit anything in the tasks view (Description, completed, priority).

I've been using the bookmarks and tasks view extensively the last few weeks while working on undo for marker operations, and I saw this problem appear Tuesday when I updated JFace with all the changes to the viewer support.
Comment 1 Tod Creasey CLA 2006-08-17 16:23:47 EDT
Looks like fallout from the Cell editing refacotring 
Comment 2 Thomas Schindl CLA 2006-08-18 01:11:39 EDT
(In reply to comment #1)
> Looks like fallout from the Cell editing refacotring 
> 
The current CVS Version seems to fix the problem but I couldn't find what you modified Tod since yesterday fixing this bug, I looked at ColumnViewer and saw that you move things into setViewerColumn.
Comment 3 Thomas Schindl CLA 2006-08-18 01:18:27 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Looks like fallout from the Cell editing refacotring 
> > 
> The current CVS Version seems to fix the problem but I couldn't find what you
> modified Tod since yesterday fixing this bug, I looked at ColumnViewer and saw
> that you move things into setViewerColumn.
> 

Further more a question why is setViewerColumn() part of the public API. Who would ever want to call this method from the outside?
Comment 4 Thomas Schindl CLA 2006-08-18 01:20:59 EDT
Created attachment 48157 [details]
Make setViewerColumn private to Class
Comment 5 Thomas Schindl CLA 2006-08-18 04:08:20 EDT
Created attachment 48158 [details]
EditorValue not saved

The editor value is not saved when the editor is finished
Comment 6 Thomas Schindl CLA 2006-08-20 11:50:48 EDT
Created attachment 48252 [details]
Fix NLP and editor value appling

Ok. I couldnow reproduce the problem and here's the patch to fix the NLP for backwards compatility. Nevertheless we should maybe also fix the BookmarkView not to start editing for none editable columns
Comment 7 Thomas Schindl CLA 2006-08-20 11:52:52 EDT
Created attachment 48253 [details]
Fix noneditable Columns in BookmarkView

This is the patch to stop editing of none-editable columns earlier.
Comment 8 Tod Creasey CLA 2006-08-21 08:04:40 EDT
setViewerColumn is called outside so that people can write thier own custom viewer column. One of the things we need to support is owner draw and other SWT features that operate directly on the widget. To do this the refresh() method needs to be overridable.

I am working on an example now to show what I mean. Thanks for the patches - I'll check them out this morning.
Comment 9 Tod Creasey CLA 2006-08-21 09:10:41 EDT
Patches released - thanks Tom.
Comment 10 Tod Creasey CLA 2006-09-19 09:21:46 EDT
Tom could you verify this in 20060919-0100 please?
Comment 11 Thomas Schindl CLA 2006-09-19 09:39:09 EDT
(In reply to comment #10)
> Tom could you verify this in 20060919-0100 please?
> 
Ok. Verified with latest JFace checkout.
Comment 12 Thomas Schindl CLA 2006-09-19 10:36:51 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Tom could you verify this in 20060919-0100 please?
> > 
> Ok. Verified with latest JFace checkout.
> 

Ok Verified in 20060919-0010.
Comment 13 Tod Creasey CLA 2006-09-19 10:41:28 EDT
Thanks Tom