Bug 5903 - NPE on shutdown in ResourceNavigator
Summary: NPE on shutdown in ResourceNavigator
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC other
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Unknown User CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 5674 5905 5956 6449 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-11-14 11:16 EST by Darin Swanson CLA
Modified: 2005-01-18 16:45 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Swanson CLA 2001-11-14 11:16:10 EST
1113

java.lang.NullPointerException
	at org.eclipse.ui.views.navigator.ResourceNavigator.setFocus
(ResourceNavigator.java:670)
	at org.eclipse.ui.internal.WorkbenchPage$1.run(WorkbenchPage.java:119)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:812)
	at org.eclipse.core.runtime.Platform.run(Platform.java:395)
	at org.eclipse.ui.internal.WorkbenchPage.activatePart
(WorkbenchPage.java:116)
	at org.eclipse.ui.internal.WorkbenchPage.setActivePart
(WorkbenchPage.java:1400)
	at org.eclipse.ui.internal.WorkbenchPage.closeAllEditors
(WorkbenchPage.java:393)
	at org.eclipse.ui.internal.WorkbenchPage.dispose(WorkbenchPage.java:538)
	at org.eclipse.ui.internal.WorkbenchWindow.closeAllPages
(WorkbenchWindow.java:316)
	at org.eclipse.ui.internal.WorkbenchWindow.hardClose
(WorkbenchWindow.java:591)
	at org.eclipse.ui.internal.WorkbenchWindow.busyClose
(WorkbenchWindow.java:261)
	at org.eclipse.ui.internal.WorkbenchWindow.access$3
(WorkbenchWindow.java:252)
	at org.eclipse.ui.internal.WorkbenchWindow$1.run
(WorkbenchWindow.java:292)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
	at org.eclipse.ui.internal.WorkbenchWindow.close
(WorkbenchWindow.java:290)
	at org.eclipse.jface.window.WindowManager.close(WindowManager.java:103)
	at org.eclipse.ui.internal.Workbench$2.run(Workbench.java:101)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:812)
	at org.eclipse.core.runtime.Platform.run(Platform.java:395)
	at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:99)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:77)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:159)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56)
	at org.eclipse.ui.internal.Workbench.close(Workbench.java:157)
	at org.eclipse.ui.internal.QuitAction.run(QuitAction.java:31)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:453)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:407)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent
(ActionContributionItem.java:361)
	at org.eclipse.jface.action.ActionContributionItem.access$0
(ActionContributionItem.java:352)
	at 
org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent
(ActionContributionItem.java:47)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:712)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:820)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285)
	at SlimLauncher.main(SlimLauncher.java:14)
Comment 1 Unknown User CLA 2001-11-22 14:10:11 EST
The NullPointerException occurs on the following line:

  getTreeViewer().getTree().setFocus();

Although it is impossible to say, I think this scenario occurs because the the 
navigator control has never been instantiated.
Comment 2 Unknown User CLA 2001-11-22 14:15:19 EST
*** Bug 5905 has been marked as a duplicate of this bug. ***
Comment 3 Unknown User CLA 2001-11-22 14:16:58 EST
*** Bug 5956 has been marked as a duplicate of this bug. ***
Comment 4 Unknown User CLA 2001-11-22 15:14:36 EST
To duplicate:

1. Close all pages in window.
2. Open new page.  Remove all views except Navigator.  Open a file editor, and 
make sure it has focus.
3. Open another new page.
4. Exit workbench.
5. Restart workbench.  Notice that second page is active.
6. Exit workbench.
Result: Same Exception as PR.

In step 5 we recreate the workbench.  The parts in the first page are 
recreated, but their controls are not.  In step 6 we exit the workbench.
In the process we close all editors in the first page.  One of them is active, 
so, after closing it, we try to activate a new part.  The navigator is chosen.  
In the process of activation we set focus to the navigator, but the navigator 
has no control, so the NPE occurs.

To fix this, we should change the following code in 
WorkbenchPage.closeAllEditors:

	if (deactivate)
		setActivePart(activationList.getActive());

to:

	if (deactivate)
		activate(activationList.getActive());

The activate method checks to see if the page is active within the window.  If 
not, then we don't actually set focus.

Note: On Nov 19, I made the change in WorkbenchPage.java to fix another 
problem, so no update is required to fix this.
Comment 5 Eduardo Pereira CLA 2001-11-23 16:30:55 EST
*** Bug 5674 has been marked as a duplicate of this bug. ***
Comment 6 Nick Edgar CLA 2001-12-04 10:31:36 EST
*** Bug 6449 has been marked as a duplicate of this bug. ***