コード例 #1
0
 @Nullable
 public FindUsagesHandler getFindUsagesHandler(
     PsiElement element, final boolean forHighlightUsages) {
   for (FindUsagesHandlerFactory factory :
       Extensions.getExtensions(FindUsagesHandlerFactory.EP_NAME, myProject)) {
     if (factory.canFindUsages(element)) {
       final FindUsagesHandler handler =
           factory.createFindUsagesHandler(element, forHighlightUsages);
       if (handler == FindUsagesHandler.NULL_HANDLER) return null;
       if (handler != null) {
         return handler;
       }
     }
   }
   return null;
 }
コード例 #2
0
 @Nullable
 public FindUsagesHandler getNewFindUsagesHandler(
     @NotNull PsiElement element, final boolean forHighlightUsages) {
   for (FindUsagesHandlerFactory factory :
       Extensions.getExtensions(FindUsagesHandlerFactory.EP_NAME, myProject)) {
     if (factory.canFindUsages(element)) {
       Class<? extends FindUsagesHandlerFactory> aClass = factory.getClass();
       FindUsagesHandlerFactory copy =
           (FindUsagesHandlerFactory)
               new ConstructorInjectionComponentAdapter(aClass.getName(), aClass)
                   .getComponentInstance(myProject.getPicoContainer());
       final FindUsagesHandler handler = copy.createFindUsagesHandler(element, forHighlightUsages);
       if (handler == FindUsagesHandler.NULL_HANDLER) return null;
       if (handler != null) {
         return handler;
       }
     }
   }
   return null;
 }