Bug 31473 Search Engine should not search in working copies that aren't on the build path
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/SearchUtil.java
if (workingCopy != null) {
			if (reconcile) {
				JavaModelUtil.reconcile(workingCopy);
				return SearchUtil.findInCompilationUnit((ICompilationUnit)workingCopy, element);
			} else {
				return SearchUtil.findInCompilationUnit((ICompilationUnit)workingCopy, element);
			}
		}
		return null;
	}
	/**
	 * Returns the compilation unit for the given java element.
	 * 
	 * @param	element the java element whose compilation unit is searched for
	 * @return	the compilation unit of the given java element
	 */
	static ICompilationUnit findCompilationUnit(IJavaElement element) {
		if (element == null)
			return null;
		if (element.getElementType() == IJavaElement.COMPILATION_UNIT)
			return (ICompilationUnit)element;
			
		if (element instanceof IMember)
			return ((IMember)element).getCompilationUnit();
		return findCompilationUnit(element.getParent());
	}
	/*
	 * Copied from JavaModelUtil and patched to allow members which do not exist.
	 * The only case where this is a problem is for methods which have same name and
	 * paramters as a constructor. The constructor will win in such a situation.