void (boolean fireEvents) { myRegistrationLock.lock(); try { Map<TextMateFileNameMatcher, CharSequence> oldExtensionsMapping = new HashMap<>(myExtensionMapping); unregisterAllBundles(); TextMateUserBundlesSettings settings = TextMateUserBundlesSettings.getInstance(); if (settings == null) { return; } Map<TextMateFileNameMatcher, CharSequence> newExtensionsMapping = new ConcurrentHashMap<>(); if (!ourBuiltinBundlesDisabled) { TextMateBuiltinBundlesSettings builtinBundlesSettings = TextMateBuiltinBundlesSettings.getInstance(); if (builtinBundlesSettings != null) { Set<String> turnedOffBundleNames = builtinBundlesSettings.getTurnedOffBundleNames(); List<TextMateBundleToLoad> builtInBundles = discoverBuiltinBundles(builtinBundlesSettings); List<TextMateBundleToLoad> bundlesToEnable = turnedOffBundleNames.isEmpty() ? builtInBundles : ContainerUtil.filter(builtInBundles, bundleToLoad -> !turnedOffBundleNames.contains(bundleToLoad.getName())); TextMateBundlesLoader.registerBundlesInParallel(myScope, bundlesToEnable, bundleToLoad -> registerBundle(Path.of(bundleToLoad.getPath()), newExtensionsMapping)); } } Map<String, TextMatePersistentBundle> userBundles = settings.getBundles(); if (!userBundles.isEmpty()) { List<@NotNull TextMateBundleToLoad> paths = ContainerUtil.mapNotNull(userBundles.entrySet(), entry -> { return entry.getValue().getEnabled() ? new TextMateBundleToLoad(entry.getValue().getName(), entry.getKey()) : null; }); TextMateBundlesLoader.registerBundlesInParallel(myScope, paths, bundleToLoad -> { return registerBundle(Path.of(bundleToLoad.getPath()), newExtensionsMapping); }, bundleToLoad -> { String bundleName = bundleToLoad.getName(); String errorMessage = TextMateBundle.message("textmate.cant.register.bundle", bundleName); new Notification("TextMate Bundles", TextMateBundle.message("textmate.bundle.load.error", bundleName), errorMessage, NotificationType.ERROR) .addAction(NotificationAction.createSimpleExpiring(TextMateBundle.message("textmate.disable.bundle.notification.action", bundleName), () -> settings.disableBundle(bundleToLoad.getPath()))) .notify(null); }); } if (fireEvents && !oldExtensionsMapping.equals(newExtensionsMapping)) { fireFileTypesChangedEvent("old mappings = " + oldExtensionsMapping + ", new mappings" + newExtensionsMapping, () -> { myExtensionMapping = newExtensionsMapping; }); } else { myExtensionMapping = newExtensionsMapping; } mySyntaxTable.compact(); } finally { myRegistrationLock.unlock(); } }