public void writeDirectoryMappings(final Element element) { if (myProject.isDefault()) { element.setAttribute(ATTRIBUTE_DEFAULT_PROJECT, Boolean.TRUE.toString()); } for (VcsDirectoryMapping mapping : getDirectoryMappings()) { Element child = new Element(ELEMENT_MAPPING); child.setAttribute(ATTRIBUTE_DIRECTORY, mapping.getDirectory()); child.setAttribute(ATTRIBUTE_VCS, mapping.getVcs()); final VcsRootSettings rootSettings = mapping.getRootSettings(); if (rootSettings != null) { Element rootSettingsElement = new Element(ELEMENT_ROOT_SETTINGS); rootSettingsElement.setAttribute(ATTRIBUTE_CLASS, rootSettings.getClass().getName()); try { rootSettings.writeExternal(rootSettingsElement); child.addContent(rootSettingsElement); } catch (WriteExternalException e) { // don't add element } } element.addContent(child); } }