@Override
  public void invoke(final @NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
    if (!FileModificationService.getInstance().preparePsiElementsForWrite(element)) return;
    final XmlFile containingFile = (XmlFile)element.getContainingFile();
    final Set<String> availableLanguages = getAvailableLanguages(project);

    LOG.assertTrue(availableLanguages != null);
    final List<String> list = new ArrayList<>(availableLanguages);

    if (availableLanguages.size() == 1) {
      registerPageLanguage(project, containingFile, availableLanguages.iterator().next());
    } else {
      JBPopupFactory.getInstance()
        .createPopupChooserBuilder(list)
        .setItemChosenCallback(
          (selectedValue) -> registerPageLanguage(project, containingFile, selectedValue))
        .createPopup().showInBestPositionFor(editor);
    }
  }
@Override
  public void invoke(final @NotNull Project project, Editor editor, @NotNull PsiElement element)