Bug 22994 Choose Package subdialog of New Class dialog crashes if source dir is not on java build path [dialogs]
There is no code for checking whether given IPackageFragmentRoot exists. Simmilar problem is in Choose Source Dir dialog - it allows you to select project even if it is not a source folder.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewContainerWizardPage.java
if (initRoot == null || initRoot.isArchive()) {
				IJavaProject jproject= elem.getJavaProject();
				if (jproject != null) {
					try {
						initRoot= null;
						IPackageFragmentRoot[] roots= jproject.getPackageFragmentRoots();
						for (int i= 0; i < roots.length; i++) {
							if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
								initRoot= roots[i];
								break;
							}
						}
					} catch (JavaModelException e) {
						JavaPlugin.log(e.getStatus());
					}
					if (initRoot == null) {
						initRoot= jproject.getPackageFragmentRoot(""); 
					}
				}
			}
		}	
		setPackageFragmentRoot(initRoot, true);
	}
	
	/**
	 * Utility method to inspect a selection to find a Java element. 
	 * 
	 * @param selection the selection to be inspected
	 * @return a Java element to be used as the initial selection, or <code>null</code>,
	 * if no Java element exists in the given selection