Ejemplo n.º 1
0
    @Override
    @SuppressWarnings("unchecked")
    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 AttributeLineElement && e2 instanceof AttributeLineElement) {
        AttributeLineElement m1 = (AttributeLineElement) e1;
        AttributeLineElement m2 = (AttributeLineElement) e2;
        return m1.getOffset() - m2.getOffset();
      }

      String name1 = fLabelProvider.getText(e1);
      String name2 = fLabelProvider.getText(e2);
      if (name1 == null) {
        name1 = ""; // $NON-NLS-1$
      }
      if (name2 == null) {
        name2 = ""; // $NON-NLS-1$
      }
      return getComparator().compare(name1, name2);
    }
Ejemplo n.º 2
0
 @Override
 public Match[] getDisplayedMatches(Object element) {
   if (showLineMatches()) {
     if (element instanceof AttributeLineElement) {
       AttributeLineElement lineEntry = (AttributeLineElement) element;
       return lineEntry.getMatches(getInput());
     }
     return new Match[0];
   }
   return getInternalDisplayedMatches(element);
 }
Ejemplo n.º 3
0
 @Override
 public int getDisplayedMatchCount(Object element) {
   if (showLineMatches()) {
     if (element instanceof AttributeLineElement) {
       AttributeLineElement lineEntry = (AttributeLineElement) element;
       return lineEntry.getNumberOfMatches(getInput());
     }
     return 0;
   }
   return super.getDisplayedMatchCount(element);
 }