Bug 6009 New class wizard doesn't get context right for nested classes
Build 20011106. - with a .java file open in the editor, - click the new class button - check "Enclosing Type" - the field is blank - it should default to the current type in the editor
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java
/** 
	 * Returns the element of the given compilation unit which is "equal" to the
	 * given element. Note that the given element usually has a parent different
	 * from the given compilation unit.
	 * 
	 * @param cu the cu to search in
	 * @param element the element to look for
	 * @return an element of the given cu "equal" to the given element
	 */		
	public static IJavaElement findInCompilationUnit(ICompilationUnit cu, IJavaElement element) throws JavaModelException {
		
		if (element instanceof IMember)
			return findMemberInCompilationUnit(cu, (IMember) element);
		
		int type= element.getElementType();
		switch (type) {
			case IJavaElement.IMPORT_CONTAINER:
				return cu.getImportContainer();
			
			case IJavaElement.PACKAGE_DECLARATION:
				return find(cu.getPackageDeclarations(), element);
			
			case IJavaElement.IMPORT_DECLARATION:
				return find(cu.getImports(), element);
			
			case IJavaElement.COMPILATION_UNIT:
				return cu;
		}