boolean (@NotNull PsiFile containingFile) { Kind kind = getKindEnum(containingFile); switch (kind) { case CLASS_OR_PACKAGE_NAME_KIND: if (resolve() instanceof PsiPackage) return true; break; case CLASS_NAME_KIND: case CLASS_IN_QUALIFIED_NEW_KIND: break; case PACKAGE_NAME_KIND: case CLASS_FQ_NAME_KIND: case CLASS_FQ_OR_PACKAGE_NAME_KIND: return true; default: throw new IllegalArgumentException("Unexpected kind: " + kind); } ASTNode qualifier = findChildByRole(ChildRole.QUALIFIER); if (qualifier == null) return false; IElementType qualifierElementType = qualifier.getElementType(); LOG.assertTrue(qualifierElementType == JavaElementType.JAVA_CODE_REFERENCE, qualifierElementType); PsiElement refElement = SourceTreeToPsiMap.<PsiJavaCodeReferenceElement>treeToPsiNotNull(qualifier).resolve(); if (refElement instanceof PsiPackage) return true; return SourceTreeToPsiMap.<PsiJavaCodeReferenceElementImpl>treeToPsiNotNull(qualifier).isFullyQualified(containingFile); }