Sorted completion list

This commit is contained in:
Manindra Moharana
2013-06-10 08:15:16 +05:30
parent 1b20eafd91
commit b853fe94bc
2 changed files with 11 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -714,6 +715,7 @@ public class ASTGenerator {
}
Collections.sort(candidates);
CompletionCandidate[][] candi = new CompletionCandidate[candidates
.size()][1];

View File

@@ -7,7 +7,7 @@ import java.util.List;
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.MethodDeclaration;
public class CompletionCandidate {
public class CompletionCandidate implements Comparable<CompletionCandidate>{
private String definingClass;
@@ -119,4 +119,12 @@ public class CompletionCandidate {
return type;
}
public int compareTo(CompletionCandidate cc) {
if(type != cc.getType()){
return cc.getType() - type;
}
return (elementName.compareTo(cc.getElementName()));
}
}