Element (@NotNull LocalChangeList list, boolean areChangeListsEnabled) { Element listNode = new Element(NODE_LIST); if (list.isDefault()) listNode.setAttribute(ATT_DEFAULT, ATT_VALUE_TRUE); listNode.setAttribute(ATT_ID, list.getId()); listNode.setAttribute(ATT_NAME, list.getName()); String comment = list.getComment(); if (comment != null) { listNode.setAttribute(ATT_COMMENT, comment); } Object listData = list.getData(); if (listData instanceof ChangeListData) { listNode.addContent(ChangeListData.writeExternal((ChangeListData)listData)); } Collection<Change> changes = list.getChanges(); if (areChangeListsEnabled || changes.size() < DISABLED_CHANGES_THRESHOLD) { List<Change> sortedChanges = ContainerUtil.sorted(changes, new ChangeComparator()); for (Change change : sortedChanges) { listNode.addContent(writeChange(change)); } } return listNode; }