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
Object elem= ((IViewPartInputProvider)part).getViewPartInput();
				if (elem instanceof IJavaElement) {
					jelem= (IJavaElement) elem;
				}
			}
		}
		if (jelem == null || jelem.getElementType() == IJavaElement.JAVA_MODEL) {
			IProject[] projects= getWorkspaceRoot().getProjects();
			if (projects.length > 0) {
				jelem= JavaCore.create(projects[0]);
			}
		}
		return jelem;
	}
	
	/**
	 * Returns the recommended maximum width for text fields (in pixels). This
	 * method requires that createContent has been called before this method is
	 * call. Subclasses may override to change the maximum width for text 
	 * fields.
	 * 
	 * @return the recommended maximum width for text fields.
	 */
	protected int getMaxFieldWidth() {
		return convertWidthInCharsToPixels(40);
	}
	
	
	/**
	 * Creates the necessary controls (label, text field and browse button) to edit