コード例 #1
0
 public boolean canFindUsages(@NotNull final PsiElement element) {
   for (FindUsagesHandlerFactory factory :
       Extensions.getExtensions(FindUsagesHandlerFactory.EP_NAME, myProject)) {
     try {
       if (factory.canFindUsages(element)) {
         return true;
       }
     } catch (IndexNotReadyException e) {
       throw e;
     } catch (Exception e) {
       LOG.error(e);
     }
   }
   return false;
 }
コード例 #2
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;
 }
コード例 #3
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;
 }