private static void registerForIconLoaderMethods(@NotNull PsiReferenceRegistrar registrar) {
    PsiMethodPattern method = psiMethod().withName("load").definedInClass(ALL_ICONS_FQN);
    PsiJavaElementPattern.Capture<PsiLiteralExpression> findGetIconPattern
      = literalExpression().and(psiExpression().methodCallParameter(0, method));
    registrar.registerReferenceProvider(findGetIconPattern, new PsiReferenceProvider() {
      @Override
      public PsiReference @NotNull [] getReferencesByElement(@NotNull final PsiElement element, @NotNull ProcessingContext context) {
        if (!IntelliJProjectUtil.isIntelliJPlatformProject(element.getProject())) return PsiReference.EMPTY_ARRAY;
        return new FileReferenceSet(element) {
          @Override
          protected Collection<PsiFileSystemItem> getExtraContexts() {
            Module iconsModule = ModuleManager.getInstance(element.getProject()).findModuleByName(PLATFORM_ICONS_MODULE);
            if (iconsModule == null) {
              iconsModule = ModuleManager.getInstance(element.getProject()).findModuleByName(ICONS_MODULE);
            }
            if (iconsModule == null) {
              return super.getExtraContexts();
            }

            final List<PsiFileSystemItem> result = new SmartList<>();
            final VirtualFile[] roots = ModuleRootManager.getInstance(iconsModule).getSourceRoots();
            final PsiManager psiManager = element.getManager();
            for (VirtualFile root : roots) {
              final PsiDirectory directory = psiManager.findDirectory(root);
              ContainerUtil.addIfNotNull(result, directory);
            }
            return result;
          }
        }.getAllReferences();
      }
    }, PsiReferenceRegistrar.HIGHER_PRIORITY);
  }
private static void registerForIconLoaderMethods(@NotNull PsiReferenceRegistrar registrar)