void () { if (!Registry.is("ssr.template.from.selection.builder")) { return; } final Document document = mySearchCriteriaEdit.getDocument(); final PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(document); assert psiFile != null; final TemplateBuilder builder = StructuralSearchTemplateBuilder.getInstance().buildTemplate(psiFile); if (builder == null) return; WriteCommandAction .runWriteCommandAction(myProject, SSRBundle.message("command.name.live.search.template.builder"), "Structural Search", () -> builder.run(Objects.requireNonNull(mySearchCriteriaEdit.getEditor()), true)); }