void (PsiElement element, SearchScope searchScope, List<? super UsageInfo> usages, @Nullable Condition<? super PsiElement> insideElements, boolean searchNonJava, boolean searchInCommentsAndStrings) { UsageInfoFactory nonCodeUsageFactory = (usage, startOffset, endOffset) -> { if (insideElements != null && insideElements.value(usage)) { return null; } return new SafeDeleteReferenceSimpleDeleteUsageInfo(usage, element, startOffset, endOffset, true, false); }; if (searchInCommentsAndStrings) { String stringToSearch = ElementDescriptionUtil.getElementDescription(element, NonCodeSearchDescriptionLocation.STRINGS_AND_COMMENTS); TextOccurrencesUtil.addUsagesInStringsAndComments(element, searchScope, stringToSearch, usages, nonCodeUsageFactory); } if (searchNonJava && searchScope instanceof GlobalSearchScope) { String stringToSearch = ElementDescriptionUtil.getElementDescription(element, NonCodeSearchDescriptionLocation.NON_JAVA); TextOccurrencesUtil.addTextOccurrences(element, stringToSearch, (GlobalSearchScope)searchScope, usages, nonCodeUsageFactory); } }