boolean (PsiElement element, @NotNull ActionContext context) { TextRange selection = context.selection(); if (!selection.isEmpty()) { final int start = selection.getStartOffset(); final int end = selection.getEndOffset(); final String text = element.getContainingFile().getViewProvider().getDocument() .getCharsSequence().subSequence(start, end).toString(); return indexOfOctalEscape(text, 1) >= 0; } else if (element instanceof PsiLiteralExpression || element instanceof PsiFragment) { final String text = element.getText(); final int offset = context.offset() - element.getTextOffset(); final int index = indexOfOctalEscape(text, offset); return index >= 0 && offset >= index; } return false; }