boolean (PsiJavaCodeReferenceElement reference) { if (!reference.isQualified()) { return false; } final PsiElement directParent = reference.getParent(); if (directParent instanceof PsiMethodCallExpression || directParent instanceof PsiAssignmentExpression || directParent instanceof PsiVariable) { return false; } final PsiElement parent = PsiTreeUtil.getParentOfType(reference, PsiImportStatementBase.class, PsiPackageStatement.class, JavaCodeFragment.class); if (parent != null) { return false; } final PsiElement target = reference.resolve(); if (!(target instanceof PsiClass aClass)) { return false; } final String fqName = aClass.getQualifiedName(); if (fqName == null) { return false; } return PsiNameHelper.getQualifiedClassName(reference.getText(), false).equals(fqName); }