boolean (@NotNull Project project, Editor editor, PsiFile file) { if (editor == null || file == null || !checkFile(file)) return false; useElementToTheLeft = false; int offset = editor.getCaretModel().getOffset(); PsiElement elementToTheRight = file.findElementAt(offset); if (elementToTheRight != null && isAvailable(project, editor, elementToTheRight)) { return true; } PsiElement elementToTheLeft = offset > 0 ? file.findElementAt(offset - 1) : null; if (elementToTheLeft != null && isAvailable(project, editor, elementToTheLeft)) { useElementToTheLeft = true; return true; } return false; }