boolean (FileTemplateBase template) { boolean shouldSave = template.isReformatCode() != FileTemplateBase.DEFAULT_REFORMAT_CODE_VALUE || !template.getFileName().isEmpty() || // check isLiveTemplateEnabledChanged() first to avoid expensive loading all templates on exit template.isLiveTemplateEnabledChanged() && template.isLiveTemplateEnabled() != template.isLiveTemplateEnabledByDefault(); if (template instanceof BundledFileTemplate) { shouldSave |= ((BundledFileTemplate)template).isEnabled() != FileTemplateBase.DEFAULT_ENABLED_VALUE; } return shouldSave || ContainerUtil.or(template.getChildren(), child -> shouldSave((FileTemplateBase)child)); }