WI-38883: Spellchecker: register dictionary filetype

This commit is contained in:
Olga Strizhenko
2017-12-25 14:42:18 +03:00
parent dde2a8f906
commit 9647a3f80d
4 changed files with 77 additions and 1 deletions
@@ -20,7 +20,7 @@
<applicationService serviceInterface="com.intellij.openapi.editor.SpellCheckingEditorCustomizationProvider"
serviceImplementation="com.intellij.spellchecker.ui.SpellCheckingEditorCustomizationProviderImpl"
overrides="true"/>
<fileTypeFactory implementation="com.intellij.spellchecker.DictionaryFileTypeFactory"/>
<projectService serviceInterface="com.intellij.spellchecker.settings.SpellCheckerSettings"
serviceImplementation="com.intellij.spellchecker.settings.SpellCheckerSettings"/>
<projectService serviceInterface="com.intellij.spellchecker.SpellCheckerManager"
@@ -0,0 +1,58 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.spellchecker;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.spellchecker.util.SpellCheckerBundle;
import icons.SpellcheckerIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class DictionaryFileType implements FileType {
public static final DictionaryFileType INSTANCE = new DictionaryFileType();
@NotNull
@Override
public String getName() {
return SpellCheckerBundle.message("dictionary.filetype.name");
}
@NotNull
@Override
public String getDescription() {
return SpellCheckerBundle.message("dictionary.filetype.description");
}
@NotNull
@Override
public String getDefaultExtension() {
return "dic";
}
@Nullable
@Override
public Icon getIcon() {
// TODO: request an icon DSGN-4790
return SpellcheckerIcons.Spellcheck;
}
@Override
public boolean isBinary() {
return false;
}
@Override
public boolean isReadOnly() {
return false;
}
@Nullable
@Override
public String getCharset(@NotNull VirtualFile file, @NotNull byte[] content) {
return null;
}
}
@@ -0,0 +1,16 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
package com.intellij.spellchecker;
import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
import org.jetbrains.annotations.NotNull;
public class DictionaryFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
consumer.consume(DictionaryFileType.INSTANCE, DictionaryFileType.INSTANCE.getDefaultExtension());
}
}
@@ -34,3 +34,5 @@ dictionaries.panel.description=Enable/disable dictionaries for your project
no.words=No additional words
no.custom.folders=No custom folders
no.dictionaries=No dictionaries found
dictionary.filetype.name=Dictionary
dictionary.filetype.description=Dictionary file