public static @NlsSafe String renderElementLocation(final PsiElement element, final Ref<? super Icon> icon) {
    if (element != null) {
      PsiFile file = element.getContainingFile();
      VirtualFile vfile = file == null ? null : file.getVirtualFile();

      if (vfile == null) {
        icon.set(null);
        return "";
      }

      final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(element.getProject()).getFileIndex();
      final Module module = fileIndex.getModuleForFile(vfile);

      if (module != null) {
        if (ModuleType.isInternal(module)) {
          icon.set(null);
          return "";
        }

        icon.set(ModuleType.get(module).getIcon());
        return module.getName();
      }
      else {
        final List<OrderEntry> entries = fileIndex.getOrderEntriesForFile(vfile);

        OrderEntry entry = null;

        for (OrderEntry order : entries) {
          if (order instanceof LibraryOrderEntry || order instanceof JdkOrderEntry) {
            entry = order;
            break;
          }
        }

        if (entry != null) {
          icon.set(AllIcons.Nodes.PpLibFolder);
          return entry.getPresentableName();
        }
      }
    }
    icon.set(null);
    return "";
  }
public static @NlsSafe String renderElementLocation(final PsiElement element, final Ref<? super Icon> icon)