/**
  * @return if given unqualified {@link SearchMatch} intersects with visibility range of {@link
  *     LocalElement}.
  */
 protected static boolean isReferenceInLocalRange(
     LocalElement localElement, SearchMatch reference) {
   if (reference.isQualified()) {
     return false;
   }
   Source localSource = localElement.getSource();
   Source referenceSource = reference.getElement().getSource();
   SourceRange localRange = localElement.getVisibleRange();
   SourceRange referenceRange = reference.getSourceRange();
   return Objects.equal(referenceSource, localSource) && referenceRange.intersects(localRange);
 }
示例#2
0
 @Override
 public int compare(SearchMatch firstMatch, SearchMatch secondMatch) {
   String firstName = firstMatch.getElement().getDisplayName();
   String secondName = secondMatch.getElement().getDisplayName();
   return Collator.getInstance().compare(firstName, secondName);
 }