use of com.intellij.usages.rules.PsiElementUsage in project intellij-community by JetBrains.
the class PyImportFilteringRule method isVisible.
@Override
public boolean isVisible(@NotNull Usage usage) {
if (usage instanceof PsiElementUsage) {
final PsiElement psiElement = ((PsiElementUsage) usage).getElement();
final PsiFile containingFile = psiElement.getContainingFile();
if (containingFile instanceof PyFile) {
// check whether the element is in the import list
final PyImportStatementBase importStatement = PsiTreeUtil.getParentOfType(psiElement, PyImportStatementBase.class, true);
return importStatement == null;
}
}
return true;
}
Aggregations