BooleanSupplier (@NotNull Editor editor, @NotNull PsiFile file, int offset, boolean allowCaretNearReference) { ApplicationManager.getApplication().assertIsNonDispatchThread(); if (!file.getViewProvider().getLanguages().contains(JavaLanguage.INSTANCE)) { return null; } Document document = editor.getDocument(); int lineNumber = document.getLineNumber(offset); int lineEndOffset = document.getLineEndOffset(lineNumber); if (editor.isDisposed() || file.getProject().isDisposed()) return null; ImportClassFix fix = computeImportFix(file, offset, lineEndOffset); if (fix == null) return null; return () -> { ImportClassFixBase.Result result = fix.doFix(editor, false, true, true); return result == ImportClassFixBase.Result.CLASS_AUTO_IMPORTED; }; }