inspection profile: no need to initialize on write when tool was not initialized (=had default settings on read)

This commit is contained in:
anna
2013-11-25 20:48:19 +01:00
parent fdb3b7421f
commit 92adf45aae
2 changed files with 7 additions and 3 deletions
@@ -313,7 +313,7 @@ public class InspectionProfileTest extends LightIdeaTestCase {
assertEquals(0, countInitializedTools(profile));
profile.writeExternal(new Element("profile"));
List<InspectionToolWrapper> initializedTools = getInitializedTools(profile);
if (initializedTools.size() != 1) {
if (initializedTools.size() > 0) {
for (InspectionToolWrapper initializedTool : initializedTools) {
System.out.println(initializedTool.getShortName());
}
@@ -145,7 +145,9 @@ public class ToolsImpl implements Tools {
scopeElement.setAttribute(LEVEL_ATTRIBUTE, state.getLevel().toString());
scopeElement.setAttribute(ENABLED_ATTRIBUTE, Boolean.toString(state.isEnabled()));
InspectionToolWrapper toolWrapper = state.getTool();
toolWrapper.getTool().writeSettings(scopeElement);
if (toolWrapper.isInitialized()) {
toolWrapper.getTool().writeSettings(scopeElement);
}
inspectionElement.addContent(scopeElement);
}
}
@@ -153,7 +155,9 @@ public class ToolsImpl implements Tools {
inspectionElement.setAttribute(LEVEL_ATTRIBUTE, getLevel().toString());
inspectionElement.setAttribute(ENABLED_BY_DEFAULT_ATTRIBUTE, Boolean.toString(myDefaultState.isEnabled()));
InspectionToolWrapper toolWrapper = myDefaultState.getTool();
toolWrapper.getTool().writeSettings(inspectionElement);
if (toolWrapper.isInitialized()) {
toolWrapper.getTool().writeSettings(inspectionElement);
}
}
void readExternal(@NotNull Element toolElement, @NotNull InspectionProfile profile) throws InvalidDataException {