void (@NotNull LookupElement element, final @NotNull Lookup lookup, @NotNull Consumer<? super @NotNull LookupElementAction> consumer) { if (element instanceof PostfixTemplateLookupElement templateLookupElement) { final PostfixTemplate template = templateLookupElement.getPostfixTemplate(); consumer.consume(new LookupElementAction(PlatformIcons.EDIT, CodeInsightBundle.message("action.text.edit.postfix.templates.settings")) { @Override public Result performLookupAction() { final Project project = lookup.getProject(); ApplicationManager.getApplication().invokeLater(() -> { if (project.isDisposed()) return; final PostfixTemplatesConfigurable configurable = new PostfixTemplatesConfigurable(); ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> { PostfixTemplatesCheckboxTree templatesTree = configurable.getTemplatesTree(); if (templatesTree != null) { templatesTree.selectTemplate(template, templateLookupElement.getProvider()); } }); }); return Result.HIDE_LOOKUP; } }); PostfixTemplatesSettings settings = PostfixTemplatesSettings.getInstance(); if (settings.isTemplateEnabled(template, templateLookupElement.getProvider())) { consumer.consume(new LookupElementAction(AllIcons.Actions.Cancel, CodeInsightBundle.message("action.text.disable.live.template", template.getKey())) { @Override public Result performLookupAction() { ApplicationManager.getApplication().invokeLater(() -> settings.disableTemplate(template, templateLookupElement.getProvider())); return Result.HIDE_LOOKUP; } }); } } }