Bug 4978 Completion list not ordered as expected
Type "fo" and press ctrl-space The best matches are the "for" templates but they are at the end of the list
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaCompletionProcessor.java
fCollector.setRegionToReplace(selection.x, selection.y);
				
				unit.codeComplete(offset, fCollector);
			}
		} catch (JavaModelException x) {
			Shell shell= viewer.getTextWidget().getShell();
			ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus()); 
		}				
		ICompletionProposal[] results= fCollector.getResults();
		try {
			if (unit != null) {			
				fTemplateEngine.reset(viewer);
				fTemplateEngine.complete(unit, offset);
			}			
		} catch (JavaModelException x) {
			Shell shell= viewer.getTextWidget().getShell();
			ErrorDialog.openError(shell, JavaTextMessages.getString("CompletionProcessor.error.accessing.title"), JavaTextMessages.getString("CompletionProcessor.error.accessing.message"), x.getStatus()); 
		}				
		
		ICompletionProposal[] exactTemplateResults= fTemplateEngine.getExactResults();
		ICompletionProposal[] notExactTemplateResults= fTemplateEngine.getNotExactResults();
		
		ICompletionProposal[] total= new ICompletionProposal[results.length + exactTemplateResults.length + notExactTemplateResults.length];
		System.arraycopy(exactTemplateResults, 0, total, 0, exactTemplateResults.length);
		System.arraycopy(results, 0, total, exactTemplateResults.length, results.length);
		System.arraycopy(notExactTemplateResults, 0, total, exactTemplateResults.length + results.length, notExactTemplateResults.length);
		
		return total;
	}
}