diff --git a/plugins/properties/properties.iml b/plugins/properties/properties.iml index 120602134ecf..60abeffd223e 100644 --- a/plugins/properties/properties.iml +++ b/plugins/properties/properties.iml @@ -16,6 +16,7 @@ + diff --git a/plugins/properties/src/META-INF/plugin.xml b/plugins/properties/src/META-INF/plugin.xml index adb8dab514c9..1e6f414ba1f3 100644 --- a/plugins/properties/src/META-INF/plugin.xml +++ b/plugins/properties/src/META-INF/plugin.xml @@ -2,6 +2,7 @@ com.intellij.properties Properties Support com.intellij.modules.xml + com.intellij.spellchecker This plugin enables smart editing of properties files. diff --git a/plugins/properties/src/META-INF/spellchecker.xml b/plugins/properties/src/META-INF/spellchecker.xml new file mode 100644 index 000000000000..4efc03afe4c0 --- /dev/null +++ b/plugins/properties/src/META-INF/spellchecker.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java b/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java new file mode 100644 index 000000000000..862ffbfb1030 --- /dev/null +++ b/plugins/properties/src/com/intellij/lang/properties/spellchecker/PropertiesSpellcheckingStrategy.java @@ -0,0 +1,44 @@ +/* + * Copyright 2000-2010 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.lang.properties.spellchecker; + +import com.intellij.lang.properties.psi.impl.PropertyImpl; +import com.intellij.lang.properties.psi.impl.PropertyValueImpl; +import com.intellij.psi.PsiElement; +import com.intellij.spellchecker.tokenizer.SimpleTokenizer; +import com.intellij.spellchecker.tokenizer.SpellcheckingStrategy; +import com.intellij.spellchecker.tokenizer.Tokenizer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * @author Konstantin Bulenkov + */ +public class PropertiesSpellcheckingStrategy extends SpellcheckingStrategy { + @NotNull + @Override + public Tokenizer getTokenizer(PsiElement element) { + if (element instanceof PropertyValueImpl) return new SimpleTokenizer(); + if (element instanceof PropertyImpl) return new SimpleTokenizer(false, ".") { + @Nullable + @Override + public String getText(PropertyImpl element) { + return element.getKey(); + } + }; + return super.getTokenizer(element); + } +} diff --git a/plugins/spellchecker/spellchecker.iml b/plugins/spellchecker/spellchecker.iml index 517fa99442d0..1e0caf8250df 100644 --- a/plugins/spellchecker/spellchecker.iml +++ b/plugins/spellchecker/spellchecker.iml @@ -8,7 +8,6 @@ - diff --git a/plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java b/plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java index b9cbc6032737..e82d78c71782 100644 --- a/plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java +++ b/plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java @@ -16,8 +16,6 @@ package com.intellij.spellchecker.tokenizer; import com.intellij.lang.Language; -import com.intellij.lang.properties.psi.impl.PropertyImpl; -import com.intellij.lang.properties.psi.impl.PropertyValueImpl; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.fileTypes.PlainTextLanguage; import com.intellij.psi.PsiComment; @@ -27,7 +25,6 @@ import com.intellij.psi.PsiPlainText; import com.intellij.psi.xml.XmlAttributeValue; import com.intellij.psi.xml.XmlText; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * @author shkate@jetbrains.com @@ -42,14 +39,6 @@ public class SpellcheckingStrategy { if (element instanceof PsiComment) return new CommentTokenizer(); if (element instanceof XmlAttributeValue) return new SimpleTokenizer(); if (element instanceof XmlText) return new SimpleTokenizer(); - if (element instanceof PropertyValueImpl) return new SimpleTokenizer(); - if (element instanceof PropertyImpl) return new SimpleTokenizer(false, ".") { - @Nullable - @Override - public String getText(PropertyImpl element) { - return element.getKey(); - } - }; if (element instanceof PsiPlainText) return new TextTokenizer(); return new Tokenizer(); }