@Override
  public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
    PsiElement psiElement = file.findElementAt(editor.getCaretModel().getOffset());
    return psiElement instanceof XmlToken && 
           (psiElement.getParent() instanceof XmlTag || psiElement.getParent() instanceof PsiErrorElement);
  }
@Override
  public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file)