void (UsageInfo[] usages, Function<? super PsiDirectory, ? extends PsiDirectory> newDirMapper) { for (UsageInfo usage : usages) { if (usage instanceof MoveDirectoryUsageInfo) { PsiReference reference = usage.getReference(); if (reference != null) { PsiFileSystemItem file = ((MoveDirectoryUsageInfo)usage).getTargetFileItem(); if (file instanceof PsiDirectory) { file = newDirMapper.fun((PsiDirectory)file); } reference.bindToElement(file); } } } }