Bug 20047 NPE in ShowInPackageViewAction
20020612 found in log java.lang.NullPointerException at org.eclipse.jdt.ui.actions.ShowInPackageViewAction.run (ShowInPackageViewAction.java:138) at org.eclipse.jdt.ui.actions.ShowInPackageViewAction.run (ShowInPackageViewAction.java:109) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:180) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:156) at org.eclipse.jface.action.Action.runWithEvent(Action.java:749) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java(Compiled Code)) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java (Compiled Code)) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java (Compiled Code)) at org.eclipse.swt.widgets.Menu.setVisible(Menu.java:920) at org.eclipse.swt.widgets.Control.WM_CONTEXTMENU(Control.java:2818) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java (Compiled Code)) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java (Compiled Code)) at org.eclipse.swt.widgets.Control.WM_RBUTTONUP(Control.java:3707) at org.eclipse.swt.widgets.Control.windowProc(Control.java(Compiled Code)) at org.eclipse.swt.widgets.Display.windowProc(Display.java(Compiled Code)) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java (Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:697) at org.eclipse.core.launcher.Main.main(Main.java:530)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/ShowInPackageViewAction.java
if (element == null)
			return null;
		switch (element.getElementType()) {
			case IJavaElement.IMPORT_DECLARATION:
			case IJavaElement.PACKAGE_DECLARATION:
			case IJavaElement.IMPORT_CONTAINER:
			case IJavaElement.TYPE:
			case IJavaElement.METHOD:
			case IJavaElement.FIELD:
			case IJavaElement.INITIALIZER:
				
				element= (IJavaElement)element.getOpenable();
				break;
			case IJavaElement.JAVA_MODEL:
				element= null;
				break;
		}
		if (element.getElementType() == IJavaElement.COMPILATION_UNIT) {
			ICompilationUnit unit= (ICompilationUnit)element;
			if (unit.isWorkingCopy())
				element= unit.getOriginalElement();
		}
		return element;
	}
	
	private static String getDialogTitle() {
		return ActionMessages.getString("ShowInPackageViewAction.dialog.title"); 
	}
}