public void addTemplate(@NotNull AnActionButton button) {
    DefaultActionGroup group = new DefaultActionGroup();
    for (Map.Entry<PostfixTemplateProvider, String> entry : getProvidersToLanguages().entrySet()) {
      PostfixTemplateProvider provider = entry.getKey();
      String providerName = provider.getPresentableName();
      if (StringUtil.isEmpty(providerName)) continue;
      group.add(new DumbAwareAction(providerName) {
        @Override
        public void actionPerformed(@NotNull AnActionEvent e) {
          PostfixTemplateEditor editor = provider.createEditor(null);
          if (editor != null) {
            PostfixEditTemplateDialog dialog = new PostfixEditTemplateDialog(PostfixTemplatesCheckboxTree.this, editor, providerName, null);
            if (dialog.showAndGet()) {
              String templateKey = dialog.getTemplateName();
              String templateId = PostfixTemplatesUtils.generateTemplateId(templateKey, provider);
              PostfixTemplate createdTemplate = editor.createTemplate(templateId, templateKey);

              PostfixTemplateCheckedTreeNode createdNode = new PostfixTemplateCheckedTreeNode(createdTemplate, provider, true);
              DefaultMutableTreeNode languageNode = findOrCreateLanguageNode(entry.getValue());
              languageNode.add(createdNode);
              myModel.nodeStructureChanged(languageNode);
              TreeUtil.selectNode(PostfixTemplatesCheckboxTree.this, createdNode);
            }
          }
        }
      });
    }
    DataContext context = DataManager.getInstance().getDataContext(button.getContextComponent());
    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup(null, group, context,
                                                                          JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true, null);
    popup.show(Objects.requireNonNull(button.getPreferredPopupPoint()));
  }
public void addTemplate(@NotNull AnActionButton button)