mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RUBY-5304: Provide rails dictionary for spellchecker
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="support" interface="com.intellij.spellchecker.tokenizer.SpellcheckingStrategy"/>
|
||||
<extensionPoint name="bundledDictionaryProvider" interface="com.intellij.spellchecker.BundledDictionaryProvider"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.spellchecker;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
|
||||
/**
|
||||
* @author oleg
|
||||
*/
|
||||
public interface BundledDictionaryProvider {
|
||||
ExtensionPointName<BundledDictionaryProvider> EP_NAME = ExtensionPointName.create("com.intellij.spellchecker.bundledDictionaryProvider");
|
||||
|
||||
String[] getBundledDictionaries();
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.spellchecker.dictionary.Dictionary;
|
||||
@@ -47,7 +48,7 @@ public class SpellCheckerManager {
|
||||
|
||||
private Dictionary userDictionary;
|
||||
|
||||
private final String[] bundledDictionaries = new String[]{"english.dic", "jetbrains.dic"};
|
||||
private final String[] BUNDLED_DICTIONARIES = new String[]{"english.dic", "jetbrains.dic"};
|
||||
|
||||
@NotNull
|
||||
private final SuggestionProvider suggestionProvider = new BaseSuggestionProvider(this);
|
||||
@@ -82,7 +83,7 @@ public class SpellCheckerManager {
|
||||
spellChecker.reset();
|
||||
final StateLoader stateLoader = new StateLoader(project);
|
||||
final List<Loader> loaders = new ArrayList<Loader>();
|
||||
for (String dictionary : bundledDictionaries) {
|
||||
for (String dictionary : getBundledDictionaries()) {
|
||||
if (this.settings == null || !this.settings.getBundledDisabledDictionariesPaths().contains(dictionary)) {
|
||||
loaders.add(new StreamLoader(SpellCheckerManager.class.getResourceAsStream(dictionary)));
|
||||
}
|
||||
@@ -128,7 +129,12 @@ public class SpellCheckerManager {
|
||||
|
||||
@NotNull
|
||||
public List<String> getBundledDictionaries() {
|
||||
return (bundledDictionaries != null ? Arrays.asList(bundledDictionaries) : Collections.<String>emptyList());
|
||||
final ArrayList<String> dictionaries = new ArrayList<String>();
|
||||
dictionaries.addAll(Arrays.asList(BUNDLED_DICTIONARIES));
|
||||
for (BundledDictionaryProvider provider : Extensions.getExtensions(BundledDictionaryProvider.EP_NAME)) {
|
||||
dictionaries.addAll(Arrays.asList(provider.getBundledDictionaries()));
|
||||
}
|
||||
return dictionaries;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -209,7 +209,7 @@ public class SpellCheckerSettingsPane implements Disposable {
|
||||
dictionariesFolders.addAll(settings.getDictionaryFoldersPaths());
|
||||
allDictionaries.clear();
|
||||
for (String dictionary : manager.getBundledDictionaries()) {
|
||||
allDictionaries.add(new Pair<String, Boolean>(dictionary, !settings.getBundledDisabledDictionariesPaths().contains(dictionary)));
|
||||
allDictionaries.add(Pair.create(dictionary, !settings.getBundledDisabledDictionariesPaths().contains(dictionary)));
|
||||
}
|
||||
|
||||
// user
|
||||
|
||||
Reference in New Issue
Block a user