1   package com.stateofflow.eclipse.metrics.properties.exclusions.table;
2   
3   import org.eclipse.core.resources.IFile;
4   import org.eclipse.jface.viewers.Viewer;
5   import org.eclipse.jface.viewers.ViewerSorter;
6   
7   class Sorter extends ViewerSorter {
8       public int compare(final Viewer viewer, final Object e1, final Object e2) {
9           return getString(e1).compareTo(getString(e2));
10      }
11  
12      private String getString(final Object e1) {
13          return e1 instanceof String ? (String) e1 : ((IFile) e1).getProjectRelativePath().toString();
14      }
15  }