Bug 4964 Automatic Code Assist needs to be smarter
Build 204 While writing SWT code, I type the following: button.dispose At this point, I do not realize that the code assist list is up because I am not looking. There are 2 items in the list now: DISPOSED int - Widget dispose() void - Widget I then type "(" because the line I was typing was supposed to be: button.dispose(); But as soon as I type the "(" then automatic code assist seems to insert whatever is selected. Since DISPOSED is first in the list and is selected, I ended up with: button.DISPOSED which isn't even close to what I want, and I have to delete it all and start again, paying more attention this time. Code assist should notice that I have typed a ( and that this matches "dispose ()" far better than "DISPOSED". Either that, or it needs to be case sensitive when it is automatically inserting stuff.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/ExperimentalResultCollector.java
public void acceptVariableName(char[] typePackageName, char[] typeName, char[] name, char[] completionName, int start, int end) {
		
		StringBuffer buf= new StringBuffer();
		buf.append(name);
		if (typeName != null && typeName.length > 0) {
			buf.append(" - "); 
			buf.append(typeName);
		}	
		fVariables.add(createCompletion(start, end, new String(completionName), null, buf.toString()));
	}	
	
	public String getErrorMessage() {
		if (fLastProblem != null)
			return fLastProblem.getAttribute(IMarker.MESSAGE, JavaTextMessages.getString("ResultCollector.compile_error.message")); 
		return ""; 
	}
	public ICompletionProposal[] getResults() {
		ArrayList result= new ArrayList();
		ProposalComparator comperator= new ProposalComparator();
		for (int i= 0; i < fResults.length; i++) {
			ArrayList bucket = fResults[i];
			int size= bucket.size();
			if (size == 1) {
				result.add(bucket.get(0));
			} else if (size > 1) {
				Object[] sortedBucket = new Object[size];
				bucket.toArray(sortedBucket);
				Arrays.sort(sortedBucket, comperator);
				for (int j= 0; j < sortedBucket.length; j++)
					result.add(sortedBucket[j]);