void (@NotNull List<? extends PsiLiteralExpression> targets) { Project project = myTarget.getProject(); PsiElement parent = myTarget.getParent().getParent(); InspectionProfileImpl inspectionProfile = InspectionProjectProfileManager.getInstance(project).getCurrentProfile(); for (PsiLiteralExpression target : targets) { Object value = target.getValue(); if (!(value instanceof String)) { continue; } List<InspectionToolWrapper<?, ?>> tools = inspectionProfile.findToolsById((String)value, target); if (tools.isEmpty()) { continue; } List<LocalInspectionToolWrapper> toolsCopy = new ArrayList<>(tools.size()); for (InspectionToolWrapper<?, ?> tool : tools) { if (tool instanceof LocalInspectionToolWrapper) { toolsCopy.add((LocalInspectionToolWrapper)tool.createCopy()); } } if (toolsCopy.isEmpty()) { continue; } GlobalInspectionContextImpl context = ((InspectionManagerEx)InspectionManager.getInstance(project)).createNewGlobalContext(); for (InspectionToolWrapper<?, ?> toolWrapper : toolsCopy) { toolWrapper.initialize(context); } ((RefManagerImpl)context.getRefManager()).runInsideInspectionReadAction(() -> { ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator == null) { indicator = new DaemonProgressIndicator(); } Map<LocalInspectionToolWrapper, List<ProblemDescriptor>> map = InspectionEngine.inspectEx(toolsCopy, myFile, parent.getTextRange(), myPriorityRange, false, true, false, indicator, PairProcessor.alwaysTrue()); for (List<ProblemDescriptor> descriptors : map.values()) { for (ProblemDescriptor descriptor : descriptors) { PsiElement element = descriptor.getPsiElement(); if (element != null) { addOccurrence(element); } } } }); } }