void (@NotNull final Element state) { myTemplates.clear(); for (Element templateElement : state.getChildren(TEMPLATE_TAG)) { PostfixTemplateProvider provider = myTemplateProviders.get(templateElement.getAttributeValue(PROVIDER_ATTR_NAME, "")); if (provider != null) { String templateId = templateElement.getAttributeValue(ID_ATTR_NAME, ""); String templateName = StringUtil.trimStart(StringUtil.notNullize(templateElement.getAttributeValue(KEY_ATTR_NAME)), "."); if (StringUtil.isEmpty(templateId) || StringUtil.isEmpty(templateName)) continue; PostfixTemplate externalTemplate = provider.readExternalTemplate(templateId, templateName, templateElement); String builtinId = templateElement.getAttributeValue(BUILTIN_ATTR_NAME); PostfixTemplate builtinTemplate = findBuiltinTemplate(builtinId, provider); if (builtinTemplate != null) { PostfixTemplate delegate = externalTemplate != null ? externalTemplate : new PostfixTemplateWrapper(templateId, templateName, "." + templateName, builtinTemplate, provider); myTemplates.putValue(provider.getId(), new PostfixChangedBuiltinTemplate(delegate, builtinTemplate)); } else if (externalTemplate != null) { myTemplates.putValue(provider.getId(), externalTemplate); } else { myUnloadedTemplates.add(templateElement); } } else { myUnloadedTemplates.add(templateElement); } } }