private Map<Extension, String> filterAndMarkExtensions(List<Extension> extensionsForThisEp, Project project) {
      JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
      GlobalSearchScope resolveScope = getElement().getResolveScope();
      PsiClass languageEpClass = javaPsiFacade.findClass(LanguageExtensionPoint.class.getCanonicalName(), resolveScope);
      if (languageEpClass == null) {
        return Collections.emptyMap();
      }
      PsiClass fileTypeEpClass = javaPsiFacade.findClass(FileTypeExtensionPoint.class.getCanonicalName(), resolveScope);
      if (fileTypeEpClass == null) {
        return Collections.emptyMap();
      }

      String currentExtensionId = myExtension.getId().getStringValue();
      String currentExtensionLanguage = getSpecificExtensionAttribute(myExtension, languageEpClass, "language");
      String currentExtensionFileType = getSpecificExtensionAttribute(myExtension, fileTypeEpClass, "filetype");

      Map<Extension, String> result = new HashMap<>();
      for (Extension extension : extensionsForThisEp) {
        String id = extension.getId().getStringValue();
        if (StringUtil.isEmpty(id) || id.equals(currentExtensionId)) {
          continue;
        }

        @NlsSafe String extensionMark = null; // to display {language} or {file type}
        if (currentExtensionLanguage != null) {
          String language = getSpecificExtensionAttribute(extension, languageEpClass, "language");
          if (language != null) {
            if (!language.equals("any") && !language.isEmpty() && !language.equals(currentExtensionLanguage)) { //NON-NLS
              continue;
            }
            extensionMark = language;
          }
        }
        if (currentExtensionFileType != null) {
          String fileType = getSpecificExtensionAttribute(extension, fileTypeEpClass, "filetype");
          if (fileType != null) {
            if (!currentExtensionFileType.equals(fileType)) {
              continue;
            }
            extensionMark = extensionMark != null ? null : fileType; // null if _somehow_ both filetype and language are present
          }
        }

        result.put(extension, extensionMark);
      }

      return result;
    }
private Map<Extension, String> filterAndMarkExtensions(List<Extension> extensionsForThisEp, Project project)