public int compare(Viewer viewer, Object o1, Object o2) { int res = 0; ITerm t1 = (ITerm) o1; ITerm t2 = (ITerm) o2; res = t1.getLabel().compareToIgnoreCase(t2.getLabel()); if (directionTerm == SWT.DOWN) res = -res; return res; }
/** * Returns an array of Strings within the input array that match the input test string * * @param items the String array of possible completions * @param prefix the incomplete String to try and match * @return the array of possible completions to the input string */ private List<ITerm> matches(List<ITerm> items, String prefix) { List<ITerm> matches = new ArrayList<ITerm>(); if (items != null) { Iterator<ITerm> it = items.iterator(); while (it.hasNext()) { ITerm term = it.next(); if (startsWithIgnoreCase(term.getLabel(), prefix)) { matches.add(term); } } } return matches; }
public String getText(Object element) { ITerm term = (ITerm) element; return term.getLabel(); }