Bug 16287 Feature request: "Search in project" option
Hi, I guess a "search in selected project" option in the search dialog would be a good feature. It could also be added to the "References", "Declarations" and "Implementators" popup menu.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchScopeFactory.java
for (int i= 0; i < resources.length; i++)
			addJavaElements(javaElements, resources[i]);
	}
	private void addJavaElements(Set javaElements, IAdaptable resource) {
		IJavaElement javaElement= (IJavaElement)resource.getAdapter(IJavaElement.class);
		if (javaElement == null)
			
			return;
		
		if (javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
			
			try {
				addJavaElements(javaElements, ((IFolder)resource).members());
			} catch (CoreException ex) {
				
			}
		}
			
		addJavaElements(javaElements, javaElement);
	}
	private void addJavaElements(Set javaElements, IJavaElement javaElement) {
		switch (javaElement.getElementType()) {
			case IJavaElement.JAVA_PROJECT:
				addJavaElements(javaElements, (IJavaProject)javaElement);
				break;
			default:
				javaElements.add(javaElement);
		}
		
	}