@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    VirtualFile[] files = getContextFiles(e, file->OverrideFileTypeManager.getInstance().getFileValue(file) == null);
    if (files.length == 0) return;
    DefaultActionGroup group = new DefaultActionGroup();
    // although well-behaved types have unique names, file types coming from plugins can be wild
    Map<String, List<String>> duplicates = Arrays.stream(FileTypeManager.getInstance().getRegisteredFileTypes())
      .map(t -> t.getDisplayName())
      .collect(Collectors.groupingBy(Function.identity()));

    for (FileType type : ContainerUtil.sorted(Arrays.asList(FileTypeManager.getInstance().getRegisteredFileTypes()),
                                              (f1,f2)->f1.getDisplayName().compareToIgnoreCase(f2.getDisplayName()))) {
      if (!OverrideFileTypeManager.isOverridable(type)) continue;
      boolean hasDuplicate = duplicates.get(type.getDisplayName()).size() > 1;
      String dupHint = null;
      if (hasDuplicate) {
        PluginDescriptor descriptor = ((FileTypeManagerImpl)FileTypeManager.getInstance()).findPluginDescriptor(type);
        dupHint = descriptor == null ? null :
                  " (" + (descriptor.isBundled() ? ActionsBundle.message("group.OverrideFileTypeAction.bundledPlugin") :
                          ActionsBundle.message("group.OverrideFileTypeAction.fromNamedPlugin", descriptor.getName()))
                  + ")";
      }
      @NlsActions.ActionText
      String displayText = type.getDisplayName() + StringUtil.notNullize(dupHint);
      group.add(new ChangeToThisFileTypeAction(displayText, files, type));
    }
    JBPopupFactory.getInstance()
      .createActionGroupPopup(ActionsBundle.message("group.OverrideFileTypeAction.title"),
                              group, e.getDataContext(), false, null, -1)
      .showInBestPositionFor(e.getDataContext());
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)