mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-CR-20566 do not write InspectionProjectProfileManager settings if empty (skip version attribute)
This commit is contained in:
@@ -461,19 +461,31 @@ fun normalizeDefaultProjectElement(defaultProject: Project, element: Element, pr
|
||||
LOG.catchAndLog {
|
||||
val iterator = element.getChildren("component").iterator()
|
||||
for (component in iterator) {
|
||||
when (component.getAttributeValue("name")) {
|
||||
"InspectionProjectProfileManager" -> convertProfiles(component.getChildren("profile").iterator(), "InspectionProjectProfileManager", projectConfigDir.resolve("inspectionProfiles"))
|
||||
val componentName = component.getAttributeValue("name")
|
||||
|
||||
fun writeProfileSettings(schemeDir: Path) {
|
||||
component.removeAttribute("name")
|
||||
if (!component.isEmpty()) {
|
||||
val wrapper = Element("component").attribute("name", componentName)
|
||||
component.name = "settings"
|
||||
wrapper.addContent(component)
|
||||
JDOMUtil.write(wrapper, schemeDir.resolve("profiles_settings.xml").outputStream(), "\n")
|
||||
}
|
||||
}
|
||||
|
||||
when (componentName) {
|
||||
"InspectionProjectProfileManager" -> {
|
||||
iterator.remove()
|
||||
val schemeDir = projectConfigDir.resolve("inspectionProfiles")
|
||||
convertProfiles(component.getChildren("profile").iterator(), componentName, schemeDir)
|
||||
component.removeChild("version")
|
||||
writeProfileSettings(schemeDir)
|
||||
}
|
||||
"CopyrightManager" -> {
|
||||
iterator.remove()
|
||||
val schemeDir = projectConfigDir.resolve("copyright")
|
||||
convertProfiles(component.getChildren("copyright").iterator(), "CopyrightManager", schemeDir)
|
||||
component.removeAttribute("name")
|
||||
if (!component.isEmpty()) {
|
||||
val wrapper = Element("component").attribute("name", "CopyrightManager")
|
||||
component.name = "settings"
|
||||
wrapper.addContent(component)
|
||||
JDOMUtil.write(wrapper, schemeDir.resolve("profiles_settings.xml").outputStream(), "\n")
|
||||
}
|
||||
convertProfiles(component.getChildren("copyright").iterator(), componentName, schemeDir)
|
||||
writeProfileSettings(schemeDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,6 +117,21 @@ internal class DefaultProjectStoreTest {
|
||||
<option name="notice" value="where" />
|
||||
</copyright>
|
||||
</component>
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AntResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesErrorsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AroundAdviceStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DeclareParentsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="EmptyEventHandler" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PointcutMethodStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
<version value="1.0" />
|
||||
</component>
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="false" />
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
@@ -162,6 +177,23 @@ internal class DefaultProjectStoreTest {
|
||||
<option name="myName" value="Foo" />
|
||||
<option name="notice" value="where" />
|
||||
</copyright>
|
||||
</component>
|
||||
|
||||
├──inspectionProfiles/
|
||||
├──Project_Default.xml
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AntDuplicateTargetsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AntMissingPropertiesFileInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="AntResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesErrorsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="ArgNamesWarningsInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AroundAdviceStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="DeclareParentsInspection" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="EmptyEventHandler" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PointcutMethodStyleInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>""".trimIndent())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user