if (subscribePsiClass == null) {
// the guava or otto library isn't available in this project so do nothing
return;
}
FindUsagesHandler handler = findUsagesManager.getNewFindUsagesHandler(subscribePsiClass, false);
if (handler != null) {
UsageInfoToUsageConverter.TargetElementsDescriptor descriptor =
new UsageInfoToUsageConverter.TargetElementsDescriptor(handler.getPrimaryElements(),
handler.getSecondaryElements());
final long startTime = System.currentTimeMillis();
Processor<Usage> processor = new Processor<Usage>() {
@Override public boolean process(Usage usage) {
if (usage instanceof UsageInfo2UsageAdapter) {
PsiElement element = ((UsageInfo2UsageAdapter) usage).getElement();
if ((element = element.getContext()) instanceof PsiAnnotation) {
if ((element = element.getContext()) instanceof PsiModifierList) {
if ((element = element.getContext()) instanceof PsiMethod) {
if (PsiConsultantImpl.hasAnnotation((PsiMethod) element, subscribeClassName)) {
maybeAddSubscriberMethod((PsiMethod) element);
}
}
}
}
}
return true;
}
};
JavaClassFindUsagesOptions options = new JavaClassFindUsagesOptions(myProject);
options.searchScope = searchScope;
FindUsagesManager.startProcessUsages(handler, handler.getPrimaryElements(), handler.getSecondaryElements(), processor, options, new Runnable() {
@Override public void run() {
int eventClassCount = optimizeEventClassIndex();
if (eventClassCount > 0) {
scheduleRefreshOfEventFiles();
} else {