Bug 30581 NPE in organize Import
Found the following in the log of PR 30427 java.lang.NullPointerException at org.eclipse.jdt.ui.actions.OrganizeImportsAction.doChooseImports (OrganizeImportsAction.java:400) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.access$1 (OrganizeImportsAction.java:398) at org.eclipse.jdt.ui.actions.OrganizeImportsAction$3.chooseImports (OrganizeImportsAction.java:393) at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.run (OrganizeImportsOperation.java:546) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation (BatchOperation.java:34) at org.eclipse.jdt.internal.core.JavaModelOperation.execute (JavaModelOperation.java:326) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:626) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1564) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:2571) at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run (WorkbenchRunnableAdapter.java:32) 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:65) at org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext.run (BusyIndicatorRunnableContext.java:120) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.runOnSingle (OrganizeImportsAction.java:361) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.run (OrganizeImportsAction.java:252) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:191) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:769) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:411) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:365) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:356) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:48) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:855) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1825) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1616) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1446) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1429) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) 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:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
}
		
	private IChooseImportQuery createChooseImportQuery() {
		return new IChooseImportQuery() {
			public TypeInfo[] chooseImports(TypeInfo[][] openChoices, ISourceRange[] ranges) {
				return doChooseImports(openChoices, ranges);
			}
		};
	}
	
	private TypeInfo[] doChooseImports(TypeInfo[][] openChoices, final ISourceRange[] ranges) {
		
		ISelection sel= fEditor.getSelectionProvider().getSelection();
		TypeInfo[] result= null;;
		ILabelProvider labelProvider= new TypeInfoLabelProvider(TypeInfoLabelProvider.SHOW_FULLYQUALIFIED);
		
		MultiElementListSelectionDialog dialog= new MultiElementListSelectionDialog(getShell(), labelProvider) {
			protected void handleSelectionChanged() {
				super.handleSelectionChanged();
				
				doListSelectionChanged(getCurrentPage(), ranges);
			}
		};
		dialog.setTitle(ActionMessages.getString("OrganizeImportsAction.selectiondialog.title")); 
		dialog.setMessage(ActionMessages.getString("OrganizeImportsAction.selectiondialog.message")); 
		dialog.setElements(openChoices);
		if (dialog.open() == Window.OK) {
			Object[] res= dialog.getResult();			
			result= new TypeInfo[res.length];
			for (int i= 0; i < res.length; i++) {