IDEA-163355 Inspection profile cannot be copied
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 31 Oct 2016 15:42:36 +0000 (16:42 +0100)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 31 Oct 2016 15:43:47 +0000 (16:43 +0100)
platform/analysis-impl/src/com/intellij/profile/ProfileEx.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/header/InspectionToolsConfigurable.java

index 6d4ae6f0e1dec0b5a0b62420dfeb0e785023edc9..0d5c69902433b2e43be51c06679ff8d1e6af0bb9 100644 (file)
@@ -82,7 +82,11 @@ public abstract class ProfileEx implements Comparable, ExternalizableScheme {
   }
 
   public final void copyFrom(@NotNull ProfileEx profile) {
-    readExternal(profile.writeScheme());
+    Element element = profile.writeScheme();
+    if (element.getName().equals("component")) {
+      element = element.getChild("profile");
+    }
+    readExternal(element);
   }
 
   @NotNull
index 4f0fd6391cb2192e43769fabef79e1f2496a0e9a..0976bdb3c6b68abd4f94670724f5893672223275 100644 (file)
@@ -144,7 +144,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable
     inspectionProfile.setName(profileDefaultName);
     inspectionProfile.initInspectionTools(project);
     inspectionProfile.setModified(true);
-    inspectionProfile.setProjectLevel(profileManager == myProjectProfileManager);
+    inspectionProfile.setProjectLevel(isProjectLevel);
 
     final InspectionProfileImpl modifiableModel = inspectionProfile.getModifiableModel();
     modifiableModel.setModified(true);