1 12 package org.eclipse.jdt.internal.corext.callhierarchy; 13 14 import java.util.Map ; 15 16 import org.eclipse.jdt.core.IJavaElement; 17 import org.eclipse.jdt.core.IMember; 18 import org.eclipse.jdt.core.search.SearchMatch; 19 import org.eclipse.jdt.core.search.SearchRequestor; 20 21 class MethodReferencesSearchRequestor extends SearchRequestor { 22 private CallSearchResultCollector fSearchResults; 23 private boolean fRequireExactMatch = true; 24 25 MethodReferencesSearchRequestor() { 26 fSearchResults = new CallSearchResultCollector(); 27 } 28 29 public Map getCallers() { 30 return fSearchResults.getCallers(); 31 } 32 33 36 public void acceptSearchMatch(SearchMatch match) { 37 if (fRequireExactMatch && (match.getAccuracy() != SearchMatch.A_ACCURATE)) { 38 return; 39 } 40 41 if (match.isInsideDocComment()) { 42 return; 43 } 44 45 if (match.getElement() != null && match.getElement() instanceof IMember) { 46 IMember member= (IMember) match.getElement(); 47 switch (member.getElementType()) { 48 case IJavaElement.METHOD: 49 case IJavaElement.TYPE: 50 case IJavaElement.FIELD: 51 case IJavaElement.INITIALIZER: 52 fSearchResults.addMember(member, member, match.getOffset(), match.getOffset()+match.getLength()); 53 break; 54 } 55 } 56 } 57 } 58 | Popular Tags |