void (@NotNull Project project) { MessageBusConnection connection = project.getMessageBus().connect(); ExtensionPoint<@NotNull KeyedLazyInstance<LanguageSubstitutor>> point = LanguageSubstitutors.getInstance().getPoint(); if (point != null) { point.addChangeListener(() -> { if (project.isDisposed()) { return; } PsiManagerImpl psiManager = (PsiManagerImpl)PsiManager.getInstance(project); ((FileManagerImpl)psiManager.getFileManager()).processFileTypesChanged(true); }, project); } connection.subscribe(AdditionalLibraryRootsListener.TOPIC, new MyAdditionalLibraryRootListener(project)); connection.subscribe(FileTypeManager.TOPIC, new FileTypeListener() { @Override public void fileTypesChanged(@NotNull FileTypeEvent e) { PsiManagerImpl psiManager = (PsiManagerImpl)PsiManager.getInstance(project); ((FileManagerImpl)psiManager.getFileManager()).processFileTypesChanged(e.getRemovedFileType() != null); } }); connection.subscribe(FileDocumentManagerListener.TOPIC, new MyFileDocumentManagerListener(project)); connection.subscribe(DynamicPluginListener.TOPIC, new DynamicPluginListener() { @Override public void pluginLoaded(@NotNull IdeaPluginDescriptor pluginDescriptor) { PsiManagerImpl psiManager = (PsiManagerImpl)PsiManager.getInstance(project); ((FileManagerImpl)psiManager.getFileManager()).processFileTypesChanged(true); } @Override public void beforePluginUnload(@NotNull IdeaPluginDescriptor pluginDescriptor, boolean isUpdate) { PsiManagerImpl psiManager = (PsiManagerImpl)PsiManager.getInstance(project); ((FileManagerImpl)psiManager.getFileManager()).processFileTypesChanged(true); } }); installGlobalListener(); }