Element () { if (myRuntimeDisabledDictionariesNames.isEmpty() && myOldDictionaryFoldersPaths.isEmpty() && myCustomDictionariesPaths.isEmpty() && myUseSingleDictionaryToSave == DEFAULT_USE_SINGLE_DICT && myDictionaryToSave.equals(DEFAULT_DICTIONARY_TO_SAVE) && !mySettingsTransferred) { return null; } final Element element = new Element(SPELLCHECKER_MANAGER_SETTINGS_TAG); // runtime element.setAttribute(RUNTIME_DICTIONARIES_ATTR_NAME, String.valueOf(myRuntimeDisabledDictionariesNames.size())); Iterator<String> iterator = myRuntimeDisabledDictionariesNames.iterator(); int i = 0; while (iterator.hasNext()) { element.setAttribute(RUNTIME_DICTIONARY_ATTR_NAME + i, iterator.next()); i++; } // user // save custom dictionaries parents because of back compatibility element.setAttribute(FOLDERS_ATTR_NAME, String.valueOf(myCustomDictionariesPaths.size())); for (int j = 0; j < myCustomDictionariesPaths.size(); j++) { final var parentPath = PathUtil.getParentPath(myCustomDictionariesPaths.get(j)); element.setAttribute(FOLDER_ATTR_NAME + j, parentPath); } // store new dictionaries settings element.setAttribute(CUSTOM_DICTIONARIES_ATTR_NAME, String.valueOf(myCustomDictionariesPaths.size())); for (int j = 0; j < myCustomDictionariesPaths.size(); j++) { element.setAttribute(CUSTOM_DICTIONARY_ATTR_NAME + j, myCustomDictionariesPaths.get(j)); } element.setAttribute(DICTIONARY_TO_SAVE_ATTR_NAME, myDictionaryToSave); element.setAttribute(USE_SINGLE_DICT_ATTR_NAME, String.valueOf(myUseSingleDictionaryToSave)); element.setAttribute(SETTINGS_TRANSFERRED, String.valueOf(mySettingsTransferred)); return element; }