void (String simpleName, String text, @NotNull Disposable parentDisposable) { FTManager defaultTemplatesManager = getSettings().getPatternsManager(); String qName = getQualifiedName(simpleName); FileTemplateBase oldTemplate = defaultTemplatesManager.getTemplate(qName); Map<String, FileTemplateBase> templates = defaultTemplatesManager.getTemplates(); templates.put(qName, new FileTemplateBase() { @Override public @NotNull String getName() { return simpleName; } @Override public void setName(@NotNull String name) { throw new AbstractMethodError(); } @Override public boolean isDefault() { return true; } @Override public @NotNull String getDescription() { throw new AbstractMethodError(); } @Override public @NotNull String getExtension() { return qName.substring(simpleName.length()); } @Override public void setExtension(@NotNull String extension) { throw new AbstractMethodError(); } @Override protected @NotNull String getDefaultText() { return text; } }); Disposer.register(parentDisposable, () -> templates.put(qName, oldTemplate)); }