@Override
    public void checkApplicability(final PsiFile psiFile, final Editor editor) throws IncorrectOperationException {
      final JspFile jspFile = (JspFile)psiFile;

      final TextRange selectedRange = JavaI18nUtil.getSelectedRange(editor, jspFile);
      // must contain no or balanced tags only
      // must not contain scriptlets or custom tags
      PsiFile root = jspFile.getBaseLanguageRoot();
      root.accept(new PsiRecursiveElementVisitor(){
        @Override public void visitElement(@NotNull PsiElement element) {
          TextRange elementRange = element.getTextRange();
          if (elementRange.intersectsStrict(selectedRange)) {
            // in JSPX base language root is a Jspx file itself
            if (!(jspFile.getLanguage() instanceof JspxLanguage) && element instanceof OuterLanguageElement ||

                element instanceof XmlTag
                && !selectedRange.contains(elementRange)
                && (!elementRange.contains(selectedRange) || !((XmlTag)element).getValue().getTextRange().contains(selectedRange))) {
              throw new IncorrectOperationException(JavaI18nBundle.message("i18nize.jsp.error"));
            }
          }
          super.visitElement(element);
        }
      });
    }
@Override
    public void checkApplicability(final PsiFile psiFile, final Editor editor)