PsiElement (PsiElement element, boolean onlyNonStatic) { final PsiFile containingFile = element.getContainingFile(); if (!(containingFile instanceof PsiJavaFile)) return null; PsiImportStatementBase importStatementBase = PsiTreeUtil.getParentOfType(element, PsiImportStatementBase.class); if (onlyNonStatic && importStatementBase instanceof PsiImportStaticStatement) { return null; } return importStatementBase; }