void (@NotNull ArrangementSettings s, @NotNull Element holder) { if (!(s instanceof StdArrangementSettings settings)) { return; } if (settings instanceof ArrangementExtendableSettings && myDefaultSettings instanceof ArrangementExtendableSettings) { final Set<StdArrangementRuleAliasToken> tokensDefinition = ((ArrangementExtendableSettings)settings).getRuleAliases(); final boolean isDefault = tokensDefinition.equals(((ArrangementExtendableSettings)myDefaultSettings).getRuleAliases()); if (!isDefault) { final Element tokensElement = new Element(TOKENS_ELEMENT_NAME); for (StdArrangementRuleAliasToken definition : tokensDefinition) { final Element tokenElement = new Element(TOKEN_ELEMENT_NAME); tokenElement.setAttribute(TOKEN_ID, definition.getId()); tokenElement.setAttribute(TOKEN_NAME, definition.getName()); final Element rulesElement = new Element(RULES_ELEMENT_NAME); for (StdArrangementMatchRule rule : definition.getDefinitionRules()) { rulesElement.addContent(serialize(rule)); } tokenElement.addContent(rulesElement); tokensElement.addContent(tokenElement); } holder.addContent(tokensElement); } } List<ArrangementGroupingRule> groupings = settings.getGroupings(); final boolean isDefaultGroupings = groupings.equals(myDefaultSettings.getGroupings()); if (!isDefaultGroupings) { Element groupingsElement = new Element(GROUPS_ELEMENT_NAME); holder.addContent(groupingsElement); for (ArrangementGroupingRule group : groupings) { Element groupElement = new Element(GROUP_ELEMENT_NAME); groupingsElement.addContent(groupElement); groupElement.addContent(new Element(TYPE_ELEMENT_NAME).setText(group.getGroupingType().getId())); groupElement.addContent(new Element(ORDER_TYPE_ELEMENT_NAME).setText(group.getOrderType().getId())); } } final List<ArrangementSectionRule> sections = settings.getSections(); final boolean isDefaultRules = sections.equals((myDefaultSettings).getSections()); if (!isDefaultRules) { Element rulesElement = new Element(RULES_ELEMENT_NAME); holder.addContent(rulesElement); for (ArrangementSectionRule section : sections) { rulesElement.addContent(serialize(section)); } } }