private static class SourceFieldComparator implements
Comparator<IModelElement> {
public int compare(IModelElement o1, IModelElement o2) {
try {
SourceRefElement e1 = (SourceRefElement) o1;
SourceRefElement e2 = (SourceRefElement) o2;
IType type1 = (IType) e1.getAncestor(IModelElement.TYPE);
IType type2 = (IType) e2.getAncestor(IModelElement.TYPE);
if (type1 != null && type2 != null && type1 != type2) {
return -1;
}
if (e1.getSourceModule() == e2.getSourceModule()) {
ISourceRange r1 = e1.getSourceRange();
ISourceRange r2 = e2.getSourceRange();
return (int) Math.signum(r1.getOffset() - r2.getOffset());
} else {
return -1;
}
} catch (ModelException e) {