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
public static int LRU_WORKINGSET_LIST_SIZE= 3;
	private static LRUWorkingSetsList fgLRUWorkingSets;
	
	private static final String DIALOG_SETTINGS_KEY= "JavaElementSearchActions"; 
	private static final String STORE_LRU_WORKING_SET_NAMES= "lastUsedWorkingSetNames"; 
	
	private static final JavaElementTypeComparator fgJavaElementTypeComparator= new JavaElementTypeComparator();
	private static IDialogSettings fgSettingsStore;
	private static final String BIN_PRIM_CONST_WARN_DIALOG_ID= "BinaryPrimitiveConstantWarningDialog"; 
	public static IJavaElement getJavaElement(IMarker marker) {
		if (marker == null || !marker.exists())
			return null;
		try {
			String handleId= (String)marker.getAttribute(IJavaSearchUIConstants.ATT_JE_HANDLE_ID);
			IJavaElement je= JavaCore.create(handleId);
			if (je == null)
				return null;
			if (!marker.getAttribute(IJavaSearchUIConstants.ATT_IS_WORKING_COPY, false)) {
				if (je != null && je.exists())
					return je;
			}
			if (isBinary(je) || fgJavaElementTypeComparator.compare(je, IJavaElement.COMPILATION_UNIT) > 0)
				return je;
			
			ICompilationUnit cu= findCompilationUnit(je);
			if (cu == null || !cu.exists()) {
				cu= (ICompilationUnit)JavaCore.create(marker.getResource());
			}