String (@NotNull PsiJavaCodeReferenceElement reference, String shortReferenceName, PsiFile containingFile) { String qualifiedName = null; if (reference.isQualified()) { qualifiedName = reference.getQualifiedName(); } else if (containingFile instanceof PsiJavaFile) { PsiImportList list = ((PsiJavaFile)containingFile).getImportList(); if (list != null) { PsiImportStatementBase statement = list.findSingleImportStatement(shortReferenceName); if (statement != null) { //noinspection ConstantConditions qualifiedName = statement.getImportReference().getQualifiedName(); } } } return qualifiedName; }