@Override
public int compare(Viewer viewer, Object e1, Object e2) {
if (e1 instanceof IRevealableReferenceNode
&& e2 instanceof IRevealableReferenceNode) {
IRevealableReferenceNode ref1 = (IRevealableReferenceNode) e1;
IRevealableReferenceNode ref2 = (IRevealableReferenceNode) e2;
if (ref1.getResource() != null
&& ref1.getResource().equals(ref2.getResource())) {
int l1 = ref1.getLineNumber();
int l2 = ref2.getLineNumber();
if (l1 < l2) {
return -1;
}
else if (l1 == l2) {
return 0;
}
else if (l1 > l2) {
return 1;
}
}
else {
super.compare(viewer, ref1.getResource(), ref2.getResource());
}
}
return super.compare(viewer, e1, e2);
}