Bug 18132 New wizards should verify if folder is on classpath
1. create J project 'P' with source folder setup (source folder 'src') 2. use new wizard to create a class ==> you can create a class inside 'P' or in a folder which is not on the classpath
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewContainerWizardPage.java
*/
	protected IJavaElement getInitialJavaElement(IStructuredSelection selection) {
		IJavaElement jelem= null;
		if (selection != null && !selection.isEmpty()) {
			Object selectedElement= selection.getFirstElement();
			if (selectedElement instanceof IAdaptable) {
				IAdaptable adaptable= (IAdaptable) selectedElement;			
				
				jelem= (IJavaElement) adaptable.getAdapter(IJavaElement.class);
				if (jelem == null) {
					IResource resource= (IResource) adaptable.getAdapter(IResource.class);
					if (resource != null && resource.getType() != IResource.ROOT) {
						while (jelem == null && resource.getType() != IResource.PROJECT) {
							resource= resource.getParent();
							jelem= (IJavaElement) resource.getAdapter(IJavaElement.class);
						}
						if (jelem == null) {
							jelem= JavaCore.create(resource); 
						}
					}
				}
			}
		}
		if (jelem == null) {
			jelem= EditorUtility.getActiveEditorJavaInput();
		}
		if (jelem == null) {
			IProject[] projects= getWorkspaceRoot().getProjects();
			if (projects.length > 0) {
				jelem= JavaCore.create(projects[0]);