Bug 34156 new class wizard defaults to wrong project
20030307 1. new workspace 2. import org.apache.ant project as binary. 3. switch to java perspective. 4. use new project button to create project zzz 5. use new class button. Notice that the source holder is org.apache.ant. The gray-lighted element in the package explorer is zzz
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewContainerWizardPage.java
* @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
	 */
	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) {
			IWorkbenchPart part= JavaPlugin.getActivePage().getActivePart();
			if (part instanceof ContentOutline) {
				part= JavaPlugin.getActivePage().getActiveEditor();