Permalink
Browse files

Fixed compilation error due to changes in red core.

  • Loading branch information...
1 parent 996f72c commit 96ba00d4a8c9609af25b781aaca0bae6f747f04c @fabioz fabioz committed Mar 22, 2011
@@ -7,6 +7,7 @@
package org.python.pydev.django_templates.completions.templates;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.templates.Template;
import org.eclipse.jface.text.templates.TemplateContext;
import org.eclipse.jface.text.templates.TemplateProposal;
@@ -19,6 +20,7 @@
private boolean isDefault;
private boolean isSuggested;
private boolean displayOnlyName;
+ private int relevance;
public DjTemplateProposal(Template template, TemplateContext context, IRegion region, Image image, int relevance, boolean displayOnlyName) {
super(template, context, region, image, relevance);
@@ -59,4 +61,34 @@ public String getDisplayString() {
}
return super.getDisplayString();
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(ICompletionProposal o) {
+ if (this == o)
+ {
+ return 0;
+ }
+
+ // not yet sorting on relevance
+ String s1 = this.getDisplayString();
+ String s2 = o.getDisplayString();
+ if(s1 == null){
+ s1 = "";
+ }
+ if(s2 == null){
+ s2 = "";
+ }
+ return s1.compareToIgnoreCase(s2);
+
+ }
+
+ public int getRelevance() {
+ return this.relevance;
+ }
+
+ public void setRelevance(int relevance) {
+ this.relevance = relevance;
+ }
}

0 comments on commit 96ba00d

Please sign in to comment.