📄 spellcheckerpreferences.java
字号:
/*******************************************************************************
* Copyright (c) 2003 Berthold Daum. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Common
* Public License v1.0 which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors: Berthold Daum
******************************************************************************/
package com.bdaum.SpellChecker.preferences;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.preference.IPreferenceStore;
import com.bdaum.SpellChecker.SpellCheckerPlugin;
import com.swabunga.spell.engine.Configuration;
public class SpellCheckerPreferences {
// Key for dictionary path
public static final String SPELL_DICTIONARY = "SPELL_DICTIONARY";
// Key for user dictionary suffix
public static final String USER_DICTIONARY = "USER_DICTIONARY";
// Key for option to ignore one letter words
public static final String IGNOREONELETTERWORDS = "ignoreOneLetterWords";
// Key for characters in compound words
public static final String COMPOUNDCHARACTERS = "compoundCharacters";
/**
* Sets the defaults for all preferences
*
* @param store -
* the PreferenceStore instance
*/
public void initializeDefaults(IPreferenceStore store) {
// Only initialize if not already initialized
// Otherwise preference.ini and plugin_customization.ini
// would not work.
if (store.getDefaultString(SPELL_DICTIONARY).length() == 0) {
initializePublicPreferences(store);
initializeHiddenPreferences(store);
}
}
/**
* Public configuration data for spell check algorithm
*
* @param store -
* the PreferenceStore instance
*/
protected void initializePublicPreferences(IPreferenceStore store) {
store.setDefault(SPELL_DICTIONARY, SpellCheckerPlugin
.getDefaultDictionaryFileName());
store.setDefault(Configuration.SPELL_THRESHOLD, 140);
store.setDefault(Configuration.SPELL_IGNOREDIGITWORDS, true);
store.setDefault(Configuration.SPELL_IGNOREINTERNETADDRESSES, false);
store.setDefault(Configuration.SPELL_IGNOREMIXEDCASE, false);
store.setDefault(Configuration.SPELL_IGNOREMULTIPLEWORDS, false);
store.setDefault(Configuration.SPELL_IGNORESENTENCECAPITALIZATION,
false);
store.setDefault(Configuration.SPELL_IGNOREUPPERCASE, false);
store.setDefault(IGNOREONELETTERWORDS, false);
store.setDefault(COMPOUNDCHARACTERS, ".:/@\\");
}
/**
* Non-public configuration data for spell check algorithm
*
* @param store -
* the PreferenceStore instance
*/
protected void initializeHiddenPreferences(IPreferenceStore store) {
store.setDefault(Configuration.COST_REMOVE_CHAR, 95);
store.setDefault(Configuration.COST_INSERT_CHAR, 95);
store.setDefault(Configuration.COST_SWAP_CHARS, 90);
store.setDefault(Configuration.COST_SUBST_CHARS, 100);
store.setDefault(Configuration.COST_CHANGE_CASE, 10);
}
/**
* Retrieve plug-in specific preferences
*
* @return Preferences
*/
public Preferences getPluginPreferences() {
return SpellCheckerPlugin.getDefault().getPluginPreferences();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -