Bug 61198 References in Project: Title shows wrong project
I200405060200 1. in the Java editor select a type from project A which comes not from the same project as the opened file (project B). 2. search for refs in project ==> title says project A, matches are from B
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchScopeFactory.java
Set javaElements;
		if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
			Iterator iter= ((IStructuredSelection) selection).iterator();
			javaElements= new HashSet(((IStructuredSelection) selection).size());
			while (iter.hasNext()) {
				Object selectedElement= iter.next();
				
				if (selectedElement instanceof ISearchResultViewEntry)
					selectedElement= ((ISearchResultViewEntry) selectedElement).getGroupByKey();
				if (selectedElement instanceof IJavaElement)
					addJavaElements(javaElements, (IJavaElement) selectedElement);
				else if (selectedElement instanceof IResource)
					addJavaElements(javaElements, (IResource) selectedElement);
				else if (selectedElement instanceof LogicalPackage)
					addJavaElements(javaElements, (LogicalPackage) selectedElement);
				else if (selectedElement instanceof IAdaptable) {
					IResource resource= (IResource) ((IAdaptable) selectedElement).getAdapter(IResource.class);
					if (resource != null)
						addJavaElements(javaElements, resource);
				}
			}
		} else {
			javaElements= EMPTY_SET;
		}
		return javaElements;
	}
	private IJavaSearchScope createJavaSearchScope(Set javaElements, boolean includeJRE) {
		if (javaElements.isEmpty())
			return EMPTY_SCOPE;
		IJavaElement[] elementArray= (IJavaElement[])javaElements.toArray(new IJavaElement[javaElements.size()]);