Bug 77030 NPE in LocalWorkingSetManager
I20041026 After starting Eclipse on an existing workspace and opening the package explorer I get this NPE: !ENTRY org.eclipse.core.runtime 4 2 2004-10-26 18:31:28.646 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.runtime". !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.ui.workingsets.dyn.LocalWorkingSetManager.restoreState(LocalWorkingSetManag er.java:150) at org.eclipse.jdt.internal.ui.workingsets.dyn.LocalWorkingSetManager.<init>(LocalWorkingSetManager.jav a:49) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel.restoreState(WorkingSetModel.java:307) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel.<init>(WorkingSetModel.java:173) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.run(PackageExplorerPart.java: 523) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616) at org.eclipse.core.runtime.Platform.run(Platform.java:747) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.init(PackageExplorerPart.java:516) at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:360) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616) at org.eclipse.core.runtime.Platform.run(Platform.java:747) at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:284) at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:578) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:575) at org.eclipse.ui.internal.ViewFactory$ViewReference.getPart(ViewFactory.java:104) at org.eclipse.ui.internal.Perspective.showFastView(Perspective.java:1656) at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1547) at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1560) at org.eclipse.ui.internal.Perspective.toggleFastView(Perspective.java:1737) at org.eclipse.ui.internal.WorkbenchPage.toggleFastView(WorkbenchPage.java:3156) at org.eclipse.ui.internal.ShowFastViewContribution.showView(ShowFastViewContribution.java: 125) at org.eclipse.ui.internal.ShowFastViewContribution.access$1(ShowFastViewContribution.java:123) at org.eclipse.ui.internal.ShowFastViewContribution$3.widgetSelected(ShowFastViewContribution.java: 106) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1229) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1253) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1238) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1086) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2894) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2562) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1527) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1498) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:276) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688) !ENTRY org.eclipse.jdt.ui 4 10001 2004-10-26 18:31:28.797 !MESSAGE Internal Error !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.internal.ui.workingsets.dyn.LocalWorkingSetManager.restoreState(LocalWorkingSetManag er.java:150) at org.eclipse.jdt.internal.ui.workingsets.dyn.LocalWorkingSetManager.<init>(LocalWorkingSetManager.jav a:49) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel.restoreState(WorkingSetModel.java:307) at org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel.<init>(WorkingSetModel.java:173) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.run(PackageExplorerPart.java: 523) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616) at org.eclipse.core.runtime.Platform.run(Platform.java:747) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.init(PackageExplorerPart.java:516) at org.eclipse.ui.internal.ViewFactory$1.run(ViewFactory.java:360) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:616) at org.eclipse.core.runtime.Platform.run(Platform.java:747) at org.eclipse.ui.internal.ViewFactory.busyRestoreView(ViewFactory.java:284) at org.eclipse.ui.internal.ViewFactory$2.run(ViewFactory.java:578) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.ViewFactory.restoreView(ViewFactory.java:575) at org.eclipse.ui.internal.ViewFactory$ViewReference.getPart(ViewFactory.java:104) at org.eclipse.ui.internal.Perspective.showFastView(Perspective.java:1656) at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1547) at org.eclipse.ui.internal.Perspective.setActiveFastView(Perspective.java:1560) at org.eclipse.ui.internal.Perspective.toggleFastView(Perspective.java:1737) at org.eclipse.ui.internal.WorkbenchPage.toggleFastView(WorkbenchPage.java:3156) at org.eclipse.ui.internal.ShowFastViewContribution.showView(ShowFastViewContribution.java: 125) at org.eclipse.ui.internal.ShowFastViewContribution.access$1(ShowFastViewContribution.java:123) at org.eclipse.ui.internal.ShowFastViewContribution$3.widgetSelected(ShowFastViewContribution.java: 106) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1229) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1253) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1238) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1086) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2894) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2562) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1527) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1498) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:276) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java
setSorter();
		fViewer.setInput(findInputElement());
		fViewer.setSelection(selection, true);
		fViewer.getControl().setRedraw(true);
	}
	public WorkingSetModel getWorkingSetModel() {
		return fWorkingSetModel;
	}
	
	public int getRootMode() {
		return fRootMode;
	}
	
	private boolean showProjects() {
		return fRootMode == ViewActionGroup.SHOW_PROJECTS;
	}
	
	private boolean showWorkingSets() {
		return fRootMode == ViewActionGroup.SHOW_WORKING_SETS;
	}
	
	private void setSorter() {
		if (showWorkingSets()) {
			fViewer.setSorter(new WorkingSetAwareJavaElementSorter());
		} else {
			fViewer.setSorter(new JavaElementSorter());
		}
	}
}