示例#1
0
  @Override
  public int compare(Viewer viewer, Object e1, Object e2) {
    int cat1 = category(e1);
    int cat2 = category(e2);

    if (cat1 != cat2) {
      return cat1 - cat2;
    }

    if (!(e1 instanceof IProperty)) {
      return 1;
    }
    if (!(e2 instanceof IProperty)) {
      return -1;
    }

    URI u1 = ((IProperty) e1).getURI();
    URI u2 = ((IProperty) e2).getURI();

    if (u1.equals(u2)) {
      return 0;
    }

    int cmpVal = getComparator().compare(u1.namespace().toString(), u2.namespace().toString());

    if (0 == cmpVal) {
      cmpVal = getComparator().compare(u1.localPart(), u2.localPart());
    }

    return cmpVal;
  }