private void addRemoveTestsScope(Project project, boolean add) { final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project); final InspectionProfileImpl profile = (InspectionProfileImpl) profileManager.getCurrentProfile(); final String shortName = myInspection.getShortName(); final InspectionToolWrapper tool = profile.getInspectionTool(shortName, project); if (tool == null) { return; } if (add) { final NamedScope namedScope = NamedScopesHolder.getScope(project, "Tests"); final HighlightDisplayKey key = HighlightDisplayKey.find(shortName); final HighlightDisplayLevel level = profile.getErrorLevel(key, namedScope, project); profile.addScope(tool, namedScope, level, false, project); } else { profile.removeScope(shortName, "Tests", project); } profile.scopesChanged(); }