Bug 18412 Type hierarchy should support JavaModel as input
To support opening a Java perspective from the Welcome page it should handle the case when it is opened with a JavaModel. This is the call to open the perspective in OpenJavaPerspectiveAction window.openPage(JavaUI.ID_PERSPECTIVE, JavaCore.create (ResourcesPlugin.getWorkspace().getRoot())); This is the NPE java.lang.NullPointerException at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.doHierarchyRefr esh(TypeHierarchyLifeCycle.java:173) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.access$0 (TypeHierarchyLifeCycle.java:133) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle$1.run (TypeHierarchyLifeCycle.java:109) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.inter nalRun(BusyIndicatorRunnableContext.java:107) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext$BusyRunnable.run (BusyIndicatorRunnableContext.java:74) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:64) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run (BusyIndicatorRunnableContext.java:120) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.ensureRefreshed TypeHierarchy(TypeHierarchyLifeCycle.java:117) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.updateInput (TypeHierarchyViewPart.java:402) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.setInputElement (TypeHierarchyViewPart.java:388) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.createPartContro l(TypeHierarchyViewPart.java:679) at org.eclipse.ui.internal.PartPane$4.run(PartPane.java:136) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:802) at org.eclipse.core.runtime.Platform.run(Platform.java:416) at org.eclipse.ui.internal.PartPane.createChildControl (PartPane.java:134) at org.eclipse.ui.internal.PartPane.createControl(PartPane.java:178) at org.eclipse.ui.internal.ViewPane.createControl(ViewPane.java:181) at org.eclipse.ui.internal.PartTabFolder.createPartTab (PartTabFolder.java:252) at org.eclipse.ui.internal.PartTabFolder.createControl (PartTabFolder.java:224) at org.eclipse.ui.internal.PartSashContainer.createControl (PartSashContainer.java:177) at org.eclipse.ui.internal.PerspectivePresentation.activate (PerspectivePresentation.java:94) at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:657) at org.eclipse.ui.internal.WorkbenchPage.onActivate (WorkbenchPage.java:1513) at org.eclipse.ui.internal.WorkbenchWindow$7.run (WorkbenchWindow.java:1165) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:64) at org.eclipse.ui.internal.WorkbenchWindow.setActivePage (WorkbenchWindow.java:1152) at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage (WorkbenchWindow.java:344) at org.eclipse.ui.internal.Workbench.busyOpenWorkbenchWindow (Workbench.java:227) at org.eclipse.ui.internal.Workbench.access$8(Workbench.java:220) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:892) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:64) at org.eclipse.ui.internal.Workbench.openWorkbenchWindow (Workbench.java:889) at org.eclipse.ui.internal.WorkbenchWindow.busyOpenPage (WorkbenchWindow.java:346) at org.eclipse.ui.internal.WorkbenchWindow$6.run (WorkbenchWindow.java:905) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:64) at org.eclipse.ui.internal.WorkbenchWindow.openPage (WorkbenchWindow.java:902) at org.eclipse.jdt.ui.actions.OpenJavaPerspectiveAction.run (OpenJavaPerspectiveAction.java:42) at org.eclipse.ui.internal.dialogs.WelcomeItem.runAction (WelcomeItem.java:137) at org.eclipse.ui.internal.dialogs.WelcomeItem.triggerLinkAt (WelcomeItem.java:156) at org.eclipse.ui.internal.dialogs.WelcomeEditor$2.mouseUp (WelcomeEditor.java:210) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:128) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:75) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1527) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1289) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1145) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1128) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:739) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) 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:200) at org.eclipse.core.launcher.Main.run(Main.java:643) at org.eclipse.core.launcher.Main.main(Main.java:476)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java
viewer.addDropSupport(ops, transfers, new DelegatingDropAdapter(dropListeners));
	}
	private void addDragAdapters(StructuredViewer viewer, int ops, Transfer[] transfers){
		Control control= viewer.getControl();
		TransferDragSourceListener[] dragListeners= new TransferDragSourceListener[] {
			new SelectionTransferDragAdapter(viewer)
		};
		DragSource source= new DragSource(control, ops);
		
		source.addDragListener(new DelegatingDragAdapter(dragListeners));		
	}	
	
	private void viewPartKeyShortcuts(KeyEvent event) {
		if (event.stateMask == SWT.CTRL) {
			if (event.character == '1') {
				setView(VIEW_ID_TYPE);
			} else if (event.character == '2') {
				setView(VIEW_ID_SUPER);
			} else if (event.character == '3') {
				setView(VIEW_ID_SUB);
			}
		}	
	}
	
		
	/**
	 * Returns the inner component in a workbench part.
	 * @see IWorkbenchPart#createPartControl
	 */
	public void createPartControl(Composite container) {