Element () { Element element = new Element("fileTemplateSettings"); for (FTManager manager : getAllManagers()) { Element templatesGroup = null; for (FileTemplateBase template : manager.getAllTemplates(true)) { // save only those settings that differ from defaults if (!shouldSave(template)) continue; final Element templateElement = saveTemplate(template); for (FileTemplate child : template.getChildren()) { templateElement.addContent(saveTemplate((FileTemplateBase)child)); } if (templatesGroup == null) { templatesGroup = new Element(getXmlElementGroupName(manager)); element.addContent(templatesGroup); } templatesGroup.addContent(templateElement); } } return element; }