public static void applyFix(@NotNull Project project, PsiFile psiFile, TextRange wordRange, String wordToSave, @Nullable DictionaryLayer layer) {
    DataManager.getInstance()
      .getDataContextFromFocusAsync()
      .onSuccess(context -> {
        if (layer == null) {
          final List<String> dictList = new ArrayList<>(
            ContainerUtil.map(DictionaryLayersProvider.getAllLayers(project), it -> it.getName())
          );

          JBPopupFactory.getInstance()
            .createPopupChooserBuilder(dictList)
            .setTitle(SpellCheckerBundle.message("select.dictionary.title"))
            .setItemChosenCallback(
              (item) ->
                CommandProcessor.getInstance().executeCommand(
                  project,
                  () -> acceptWord(wordToSave, DictionaryLayersProvider.getLayer(project, item), psiFile, wordRange),
                  SpellCheckerBundle.message("save.0.to.dictionary.action", wordToSave),
                  null
                )
            )
            .setRenderer(SimpleListCellRenderer.create(
              (var label, @NlsContexts.Label var value, var index) -> {
                label.setText(value);
                label.setBorder(JBUI.Borders.empty(0, 15));
              }))
            .createPopup()
            .showInBestPositionFor(context);
        }
        else {
          acceptWord(wordToSave, layer, psiFile, wordRange);
        }
      });
  }
public static void applyFix(@NotNull Project project, PsiFile psiFile, TextRange wordRange, String wordToSave, @Nullable DictionaryLayer layer)