remove dependency on properties from spellchecker

This commit is contained in:
Konstantin Bulenkov
2010-01-26 14:22:45 +03:00
parent 3f73c21123
commit 6d7520b37e
6 changed files with 52 additions and 12 deletions
+1
View File
@@ -16,6 +16,7 @@
<orderEntry type="module" module-name="boot" />
<orderEntry type="module" module-name="annotations" />
<orderEntry type="module" module-name="testFramework" />
<orderEntry type="module" module-name="spellchecker" />
</component>
</module>
@@ -2,6 +2,7 @@
<id>com.intellij.properties</id>
<name>Properties Support</name>
<depends>com.intellij.modules.xml</depends>
<depends optional="true" config-file="spellchecker.xml">com.intellij.spellchecker</depends>
<description>
This plugin enables smart editing of properties files.
</description>
@@ -0,0 +1,6 @@
<!DOCTYPE idea-plugin PUBLIC "Plugin/DTD" "http://plugins.intellij.net/plugin.dtd">
<idea-plugin url="http://www.jetbrains.com/idea">
<extensions xmlns="com.intellij">
<spellchecker.support implementation="com.intellij.lang.properties.spellchecker.PropertiesSpellcheckingStrategy"/>
</extensions>
</idea-plugin>
@@ -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<PropertyImpl>(false, ".") {
@Nullable
@Override
public String getText(PropertyImpl element) {
return element.getKey();
}
};
return super.getTokenizer(element);
}
}
-1
View File
@@ -8,7 +8,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="properties" exported="" />
<orderEntry type="module" module-name="lang-api" />
<orderEntry type="module" module-name="lang-impl" />
<orderEntry type="module" module-name="platform-api" />
@@ -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<PropertyImpl>(false, ".") {
@Nullable
@Override
public String getText(PropertyImpl element) {
return element.getKey();
}
};
if (element instanceof PsiPlainText) return new TextTokenizer();
return new Tokenizer();
}