Set javaElements= getJavaElements(selection); Set javaProjects= new HashSet(javaElements.size()); Iterator elements= javaElements.iterator(); while (elements.hasNext()) { IJavaProject jp= ((IJavaElement)elements.next()).getJavaProject(); if (jp != null) javaProjects.add(jp); }
Set javaProjects= getJavaProjects(selection);
	public IJavaSearchScope createJavaProjectSearchScope(ISelection selection) {		Set javaElements= getJavaElements(selection);		Set javaProjects= new HashSet(javaElements.size());		Iterator elements= javaElements.iterator();		while (elements.hasNext()) {			IJavaProject jp= ((IJavaElement)elements.next()).getJavaProject();			if (jp != null)				javaProjects.add(jp);			}		return createJavaSearchScope(javaProjects);	}