Bug 12911 Open Type dialog doesn't always combine types with same name
Build 20020321 Create the following three classes: bar.FOO baz.Foo quux.FOO Now open the 'Open Type' dialog, and type in 'foo'. The list will have three entries in it: +-----+ | FOO | | Foo | | FOO | +-----+ This is incorrect. The two 'FOO' entries should be combined, and the list should look like: +-----+ | FOO | | Foo | +-----+ I suspect that this is due to a compare function which doesn't distinguish between strings which only differ by case, causing them to appear in an arbitrary order in a sorted list.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/TypeSelectionDialog.java
*/
		public boolean match(Object element) {
			if (!(element instanceof TypeInfo))
				return false;
			TypeInfo type= (TypeInfo) element;
			if (!fMatcher.match(type.getTypeName()))
				return false;
			if (fQualifierMatcher == null)
				return true;
			return fQualifierMatcher.match(type.getTypeContainerName());
		}	
	}
	
	/*
	 * A string comparator which is aware of obfuscated code
	 * (type names starting with lower case characters).
	 */
	private static class StringComparator implements Comparator {
	    public int compare(Object left, Object right) {
	     	String leftString= (String) left;
	     	String rightString= (String) right;
	     		     	
	     	if (Character.isLowerCase(leftString.charAt(0)) &&
	     		!Character.isLowerCase(rightString.charAt(0)))
	     		return +1;
	     	if (Character.isLowerCase(rightString.charAt(0)) &&
	     		!Character.isLowerCase(leftString.charAt(0)))
	     		return -1;
	     	
			return leftString.compareToIgnoreCase(rightString);