mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
[spellchecker] introduce CustomDictionarySettingsListener to get rid of hack in Rider (IJPL-189900)
Before, SpellCheckerSettingsManager extension was replaced by a patched variant in Rider. The new listener allows us to get rid of this hack, making it simpler to extract code related to spellchecker in a separate module in Rider (this is needed to extract intellij.spellchecker to a content module). GitOrigin-RevId: 38f550b633c5596c41186dab9bff4fc5cc37fb9b
This commit is contained in:
committed by
intellij-monorepo-bot
parent
772064c9c3
commit
cf104126ff
@@ -31,6 +31,7 @@ import static java.util.Arrays.asList;
|
||||
|
||||
public final class CustomDictionariesPanel extends JPanel {
|
||||
private final SpellCheckerSettings mySettings;
|
||||
private final @NotNull Project myProject;
|
||||
private final @NotNull SpellCheckerManager myManager;
|
||||
private final CustomDictionariesTableView myCustomDictionariesTableView;
|
||||
private final List<String> removedDictionaries = new ArrayList<>();
|
||||
@@ -39,6 +40,7 @@ public final class CustomDictionariesPanel extends JPanel {
|
||||
|
||||
public CustomDictionariesPanel(@NotNull SpellCheckerSettings settings, @NotNull Project project, @NotNull SpellCheckerManager manager) {
|
||||
mySettings = settings;
|
||||
myProject = project;
|
||||
myManager = manager;
|
||||
defaultDictionaries = project.isDefault() ? new ArrayList<>() : asList(SpellCheckerBundle.message("app.dictionary"), SpellCheckerBundle
|
||||
.message("project.dictionary"));
|
||||
@@ -145,6 +147,7 @@ public final class CustomDictionariesPanel extends JPanel {
|
||||
}));
|
||||
mySettings.setCustomDictionariesPaths(newPaths);
|
||||
myManager.updateBundledDictionaries(ContainerUtil.filter(oldPaths, o -> !newPaths.contains(o)));
|
||||
myProject.getMessageBus().syncPublisher(CustomDictionarySettingsListener.CUSTOM_DICTIONARY_SETTINGS_TOPIC).customDictionaryPathsChanged(newPaths);
|
||||
}
|
||||
|
||||
public List<String> getValues() {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.spellchecker.settings
|
||||
|
||||
import com.intellij.util.messages.Topic
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Provides notifications when custom dictionaries are changed in Settings.
|
||||
*/
|
||||
interface CustomDictionarySettingsListener : EventListener {
|
||||
companion object {
|
||||
@JvmField
|
||||
@Topic.ProjectLevel
|
||||
val CUSTOM_DICTIONARY_SETTINGS_TOPIC: Topic<CustomDictionarySettingsListener> = Topic(CustomDictionarySettingsListener::class.java, Topic.BroadcastDirection.NONE)
|
||||
}
|
||||
|
||||
fun customDictionaryPathsChanged(newPaths: List<String>)
|
||||
}
|
||||
Reference in New Issue
Block a user