code cleanup: run by name cleanup inspection must fix only this inspection problems
[idea/community.git] / platform / lang-impl / src / com / intellij / codeInspection / actions / RunInspectionIntention.java
index cbf00cafed63940855d598c7d964b7cf2097a162..f6f0682301800c1df081cc5fb5ef06e4a2c51134 100644 (file)
@@ -122,9 +122,20 @@ public class RunInspectionIntention implements IntentionAction, HighPriorityActi
     inspectionContext.doInspections(scope);
   }
 
+  @NotNull
   public static GlobalInspectionContextImpl createContext(@NotNull InspectionToolWrapper toolWrapper,
                                                           @NotNull InspectionManagerEx managerEx,
                                                           @Nullable PsiElement psiElement) {
+    final InspectionProfileImpl model = createProfile(toolWrapper, managerEx, psiElement);
+    final GlobalInspectionContextImpl inspectionContext = managerEx.createNewGlobalContext(false);
+    inspectionContext.setExternalProfile(model);
+    return inspectionContext;
+  }
+
+  @NotNull
+  public static InspectionProfileImpl createProfile(@NotNull InspectionToolWrapper toolWrapper,
+                                                    @NotNull InspectionManagerEx managerEx,
+                                                    @Nullable PsiElement psiElement) {
     final InspectionProfileImpl rootProfile = (InspectionProfileImpl)InspectionProfileManager.getInstance().getRootProfile();
     LinkedHashSet<InspectionToolWrapper> allWrappers = new LinkedHashSet<InspectionToolWrapper>();
     allWrappers.add(toolWrapper);
@@ -145,9 +156,7 @@ public class RunInspectionIntention implements IntentionAction, HighPriorityActi
     catch (InvalidDataException ignored) {
     }
     model.setSingleTool(toolWrapper.getShortName());
-    final GlobalInspectionContextImpl inspectionContext = managerEx.createNewGlobalContext(false);
-    inspectionContext.setExternalProfile(model);
-    return inspectionContext;
+    return model;
   }
 
   @Override