private @NotNull FileType loadFileType(@NotNull Object context,
                                         @NotNull Element typeElement,
                                         @NotNull PluginDescriptor pluginDescriptor,
                                         @NotNull PluginAdvertiserExtensionsStateService pluginAdvertiserExtensionsStateService,
                                         boolean isDefault) {
    String fileTypeName = typeElement.getAttributeValue(ATTRIBUTE_NAME);

    String extensionsStr = ObjectUtils.notNull(typeElement.getAttributeValue("extensions"), "");
    if (isDefault && !extensionsStr.isEmpty()) {
      // todo support wildcards
      extensionsStr = filterAlreadyRegisteredExtensions(extensionsStr);
    }

    FileTypeWithDescriptor ftd = isDefault && fileTypeName != null ? getFileTypeWithDescriptorByName(fileTypeName) : null;
    if (ftd != null) {
      return ftd.fileType();
    }

    Element element = typeElement.getChild(AbstractFileType.ELEMENT_HIGHLIGHTING);
    UserFileType<?> type;
    if (element == null) {
      type = UserBinaryFileType.INSTANCE;
    }
    else {
      SyntaxTable table = AbstractFileType.readSyntaxTable(element);
      type = new AbstractFileType(table);
      ((AbstractFileType)type).initSupport();
    }

    @NlsSafe String fileTypeDescr = typeElement.getAttributeValue(ATTRIBUTE_DESCRIPTION);
    if (isDefault && fileTypeDescr != null && fileTypeDescr.contains("syntax highlighting only")) {
      fileTypeDescr = fileTypeDescr.replace("syntax highlighting only", FileTypesBundle.message("filetype.default.syntax.highlighting.only.description"));
    }
    String iconPath = typeElement.getAttributeValue("icon");
    setFileTypeAttributes(type, fileTypeName, fileTypeDescr, iconPath);
    registerFileTypeWithoutNotification(type,
                                        pluginDescriptor,
                                        parseExtensions(context, extensionsStr),
                                        pluginAdvertiserExtensionsStateService,
                                        isDefault);

    if (isDefault) {
      defaultTypes.add(new FileTypeWithDescriptor(type, pluginDescriptor));
      if (type instanceof ExternalizableFileType) {
        ((ExternalizableFileType)type).markDefaultSettings();
      }
    }
    else {
      Element extensions = typeElement.getChild(ELEMENT_EXTENSION_MAP);
      if (extensions != null) {
        FileTypeWithDescriptor newFtd = new FileTypeWithDescriptor(type, pluginDescriptor);
        for (Pair<FileNameMatcher, String> association : AbstractFileType.readAssociations(extensions)) {
          associate(newFtd, association.getFirst(), false);
        }
        for (RemovedMappingTracker.RemovedMapping removedAssociation : RemovedMappingTracker.readRemovedMappings(extensions)) {
          removeAssociation(newFtd, removedAssociation.getFileNameMatcher(), false);
        }
      }
    }
    return type;
  }
private @NotNull FileType loadFileType(@NotNull Object context,
                                         @NotNull Element typeElement,
                                         @NotNull PluginDescriptor pluginDescriptor,
                                         @NotNull PluginAdvertiserExtensionsStateService pluginAdvertiserExtensionsStateService,
                                         boolean isDefault)