use of com.jetbrains.python.findUsages.PyClassFindUsagesHandler in project intellij-community by JetBrains.
the class PyStaticCallHierarchyUtil method createFindUsageHandler.
/**
* @see {@link com.jetbrains.python.findUsages.PyFindUsagesHandlerFactory#createFindUsagesHandler(com.intellij.psi.PsiElement, boolean) createFindUsagesHandler}
*/
@Nullable
private static FindUsagesHandler createFindUsageHandler(@NotNull final PsiElement element) {
if (element instanceof PyFunction) {
final TypeEvalContext context = TypeEvalContext.userInitiated(element.getProject(), null);
final Collection<PsiElement> superMethods = PySuperMethodsSearch.search((PyFunction) element, true, context).findAll();
if (superMethods.size() > 0) {
final PsiElement next = superMethods.iterator().next();
if (next instanceof PyFunction && !isInObject((PyFunction) next)) {
List<PsiElement> allMethods = Lists.newArrayList();
allMethods.add(element);
allMethods.addAll(superMethods);
return new PyFunctionFindUsagesHandler(element, allMethods);
}
}
return new PyFunctionFindUsagesHandler(element);
}
if (element instanceof PyClass) {
return new PyClassFindUsagesHandler((PyClass) element);
}
return null;
}
Aggregations