boolean (@NotNull Editor editor) { List<? extends ImportCandidateHolder> imports = myDelegate.getCandidates(); if (!PyCodeInsightSettings.getInstance().SHOW_IMPORT_POPUP || HintManager.getInstance().hasShownHintsThatWillHideByOtherHint(true) || imports.isEmpty()) { return false; } final PsiElement element = myDelegate.getStartElement(); PyPsiUtils.assertValid(element); if (element == null || !element.isValid()) { return false; } final PyElement pyElement = as(element, PyElement.class); String initialName = myDelegate.getNameToImport(); if (pyElement == null || !initialName.equals(pyElement.getName())) { return false; } final PsiReference reference = myDelegate.findOriginalReference(element); if (reference == null || AutoImportQuickFix.isResolved(reference)) { return false; } if (element instanceof PyQualifiedExpression && ((PyQualifiedExpression)element).isQualified()) { return false; // we cannot be qualified } final String message = ShowAutoImportPass.getMessage( imports.size() > 1, DaemonBundle.message("symbol"), ImportCandidateHolder.getQualifiedName(initialName, imports.get(0).getPath(), imports.get(0).getImportElement()) ); final ImportFromExistingAction action = myDelegate.createAction(element); HintManager.getInstance().showQuestionHint( editor, message, element.getTextOffset(), element.getTextRange().getEndOffset(), action); return true; }