@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; }
@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; }