Bug 16822 Search results should be removed when cu is moved
Build 20020521 1. Create project P with 2 source folders 'src1 and 'src2' 2. Create cu X.java under 'P/src1'. public class X { } 3. Search for declaration of X 4. Move X.java to 'P/src2' Observe: The search result in still in the search view. Attempting to double-click on the search result opens a 'Search Error' dialog saying: An error occured while creating a Java element. Reason: X.java does not exist
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/browsing/JavaElementTypeComparator.java
* 
	 * @see Comparator#compare(Object, Object)
	 */
	public int compare(Object o1, Object o2) {
		if (!(o1 instanceof IJavaElement) || !(o2 instanceof IJavaElement))
			throw new ClassCastException();
		return getIdForJavaElement((IJavaElement)o1) - getIdForJavaElement((IJavaElement)o2);
	}
	/**
	 * Compares two Java element types. A type is considered to be
	 * greater if it may contain the other.
	 * 
	 * @return		an int < 0 if object1 is less than object2,
	 *				0 if they are equal, and > 0 if object1 is greater
	 * 
	 * @see Comparator#compare(Object, Object)
	 */
	public int compare(Object o1, int elementType) {
		if (!(o1 instanceof IJavaElement))
			throw new ClassCastException();
		return getIdForJavaElement((IJavaElement)o1) - getIdForJavaElementType(elementType);
	}
	int getIdForJavaElement(IJavaElement element) {
		return getIdForJavaElementType(element.getElementType());
	}
	
	int getIdForJavaElementType(int elementType) {
		switch (elementType) {
			case IJavaElement.JAVA_MODEL:
				return 130;