private @NotNull JBPopup createFileTypesPopup(@NotNull DropDownLink<String> link) {
    CheckedTreeNode root = new CheckedTreeNode(CodeInsightBundle.message("actions.on.save.page.label.all.file.types"));

    SortedSet<FileType> result = new TreeSet<>(Comparator.comparing(FileType::getDescription, String.CASE_INSENSITIVE_ORDER));
    addApplicableFileTypes(result);

    for (FileType fileType : result) {
      root.add(new CheckedTreeNode(fileType));
    }

    CheckboxTree tree = createFileTypesCheckboxTree(root);

    return JBPopupFactory.getInstance().createComponentPopupBuilder(new JBScrollPane(tree), tree)
      .setRequestFocus(true)
      .addListener(new JBPopupListener() {
        @Override
        public void onClosed(@NotNull LightweightWindowEvent event) {
          onFileTypePopupClosed(link, root);
        }
      })
      .createPopup();
  }
private @NotNull JBPopup createFileTypesPopup(@NotNull DropDownLink<String> link)