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
}
	private Set getJavaProjects(ISelection selection) {
		Set javaProjects;
		if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
			Iterator iter= ((IStructuredSelection) selection).iterator();
			javaProjects= new HashSet(((IStructuredSelection) selection).size());
			while (iter.hasNext()) {
				Object selectedElement= iter.next();
				
				if (selectedElement instanceof ISearchResultViewEntry)
					selectedElement= ((ISearchResultViewEntry) selectedElement).getGroupByKey();
				if (selectedElement instanceof LogicalPackage)
					
					javaProjects.add(((LogicalPackage) selectedElement).getJavaProject());
				else if (selectedElement instanceof IAdaptable) {
					IJavaProject javaProject= getJavaProject((IAdaptable) selectedElement);
					if (javaProject != null)
						javaProjects.add(javaProject);
				}
			}
		} else {
			javaProjects= EMPTY_SET;
		}
		return javaProjects;
	}
	private IJavaProject getJavaProject(IAdaptable selectedElement) {
		IJavaProject javaProject= (IJavaProject) selectedElement.getAdapter(IJavaProject.class);
		if (javaProject != null)
			return javaProject;
		IJavaElement javaElement= (IJavaElement) selectedElement.getAdapter(IJavaElement.class);