⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spellcheckconfiguration.java

📁 Eclipse高级编程3源码(书本源码)
💻 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;

import org.eclipse.core.runtime.Preferences;

import com.bdaum.SpellChecker.preferences.SpellCheckerPreferences;
import com.swabunga.spell.engine.Configuration;

public class SpellCheckConfiguration extends Configuration {

	private static final String TRUE = "true";

	/**
	 * Fetch integer value from Preferences
	 * 
	 * @param key -
	 *            identification of value
	 * @return - value belonging to the key
	 */
	public int getInteger(String key) {
		try {
			return Integer.parseInt(getString(key));
		} catch (NumberFormatException e) {
			return 0;
		}
	}

	/**
	 * Fetch Boolean value from Preferences
	 * 
	 * @param key -
	 *            identification of value
	 * @return - value belonging to the key
	 */
	public boolean getBoolean(String key) {
		return TRUE.equals(getString(key));
	}

	/**
	 * Fetch string value from Properties or Preferences
	 * 
	 * @param key -
	 *            identification of value
	 * @return - value belonging to the key
	 */
	public String getString(String key) {
		SpellCheckerPreferences preferences = SpellCheckerPlugin.getManager()
				.getPreferences();
		Preferences prefs = preferences.getPluginPreferences();
		return prefs.getString(key);
	}

	/**
	 * All preferences are set via the PreferencePages. Therefore, the setXXX()
	 * implementation do nothing here.
	 */
	public void setInteger(String key, int value) {
	}

	public void setBoolean(String key, boolean value) {
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -