亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? spellcheckmanager.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 java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

import org.eclipse.core.runtime.*;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;

import com.bdaum.SpellChecker.actions.CheckSpellingActionDelegate;
import com.bdaum.SpellChecker.preferences.SpellCheckerPreferences;
import com.bdaum.SpellChecker.views.SpellCorrectionView;
import com.swabunga.spell.engine.GenericSpellDictionary;
import com.swabunga.spell.engine.SpellDictionary;
import com.swabunga.spell.engine.SpellDictionaryDichoDisk;
import com.swabunga.spell.event.SpellCheckEvent;
import com.swabunga.spell.event.SpellCheckListener;
import com.swabunga.spell.event.SpellChecker;

/**
 * This class organizes the interaction between the SpellChecker, the user
 * interface, and the spell checker configuration.
 */
public class SpellCheckManager implements SpellCheckListener {

	// File extension for phonetic dictionaries
	private static final String PHONETICEXTENSION = ".phon";

	// File extension for user dictionary
	private static final String USEREXTENSION = ".user";

	// Tuple representing an empty text selection
	private static final Point NOSELECTION = new Point(0, 0);

	/* The engines for the spell checker */
	private Map engineMap = new HashMap(10);

	private SpellChecker currentEngine;

	/* The spell checking view */
	private SpellCorrectionView correctionViewer;

	/* Currently active preferences */
	private SpellCheckerPreferences currentPreferences;

	/* The configuration */
	private SpellCheckConfiguration config = new SpellCheckConfiguration();

	/* The curent spell checking target */
	private SpellCheckingTarget currentTarget;

	/* The current selection */
	private Point currentSelection = NOSELECTION;

	/* current Display */
	private Display display;

	/* Indicator for aborting the current spell checking process */
	private boolean abort = false;

	/* Current tokenizer name */
	private String currentName;

	/**
	 * Checks the document content. This method is thread safe.
	 * 
	 * @param target -
	 *            the spell checking target
	 * @param display -
	 *            the current Display instance
	 * @param correctionViewer -
	 *            the spell checking view
	 */
	public synchronized void checkDocument(SpellCheckingTarget target,
			Display display, SpellCorrectionView correctionViewer) {
		this.display = display;
		// First reset the current preferences to the default preferences
		currentPreferences = SpellCheckerPlugin.getDefault().getPreferences();
		// Save parameters
		this.correctionViewer = correctionViewer;
		this.currentTarget = target;
		// Reset tokenizer name and selection
		currentName = Messages
				.getString("SpellCheckManager.Default_Spell_Checker");
		currentSelection = NOSELECTION;
		// This following must be done in the SWT thread to avoid
		// thread conflicts
		display.syncExec(new Runnable() {
			public void run() {
				// Retrieve current text selection
				currentSelection = currentTarget.getSelection();
			}
		});
		// Get preferences and find tokenizer
		IEditorInput input = target.getEditorInput();
		if (input != null) {
			// We deal with a editor input object and retrieve an input
			// specific tokenizer
			currentTarget.tokenizer = getDocumentWordTokenizer(input);
			if (currentTarget.tokenizer != null)
				performCheck();
		} else {
			// We cannot determine the text type
			// and use the default preferences
			currentPreferences = SpellCheckerPlugin.getDefault()
					.getPreferences();
			currentTarget.tokenizer = new DocumentWordTokenizer();
			performCheck();
		}
	}

	/**
	 * Returns the current spell check target
	 * 
	 * @return - Target object
	 */
	public SpellCheckingTarget getCurrentTarget() {
		return currentTarget;
	}

	/**
	 * Returns the current tokenizer name
	 * 
	 * @return - tokenizer name
	 */
	public String getCurrentName() {
		return currentName;
	}

	/**
	 * Retrieves a suitable tokenizer for a given input
	 * 
	 * @param input -
	 *            the current editor input
	 * @return - the tokenizer configured for this input type
	 */
	private AbstractDocumentWordTokenizer getDocumentWordTokenizer(
			IEditorInput input) {
		// Get file extension form editor input
		String doctype = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input)
				.getFile().getFullPath().getFileExtension()
				: "*";
		// Search for extensions to extension point "documentTokenizer"
		// First get the plug-in registry
		IExtensionRegistry reg = Platform.getExtensionRegistry();
		// Now get the extension point
		IExtensionPoint exPoint = reg.getExtensionPoint(SpellCheckerPlugin
				.getId(), "documentTokenizer");
		// Fetch all installed extensions for this extension point.
		// This can be more than one if several plug-ins were installed.
		IExtension[] tokenizers = exPoint.getExtensions();
		for (int i = 0; i < tokenizers.length; i++) {
			IExtension extension = tokenizers[i];
			// Now fetch all tokenizer specifications
			// Each extension can define several of these specifications
			IConfigurationElement[] configurations = extension
					.getConfigurationElements();
			for (int j = 0; j < configurations.length; j++) {
				IConfigurationElement element = configurations[j];
				// For each tokenizer we step through the list
				// of declared file extensions
				StringTokenizer st = new StringTokenizer(element
						.getAttribute("extensions"));
				while (st.hasMoreElements()) {
					String ext = st.nextToken();
					if (ext.equalsIgnoreCase(doctype)) {
						// Positive
						try {
							// Now fetch the plug-in specific preferences
							currentPreferences = (SpellCheckerPreferences) element
									.createExecutableExtension("preferences");
						} catch (CoreException e) {
							// No luck, we use the default preferences
						}
						currentName = element.getAttribute("name");
						try {
							// Try to create a tokenizer instance
							return (AbstractDocumentWordTokenizer) element
									.createExecutableExtension("class");
						} catch (CoreException e) {
							SpellCheckerPlugin
									.logError(
											1,
											Messages
													.getString("SpellCheckManager.Could_not_create_tokenizer"),
											e);
						}
					}
				}
			}
		}
		// No matching extension found. Use the default tokenizer.
		return new DocumentWordTokenizer();
	}

	/**
	 * Returns the current SpellCheckerPreference.
	 * 
	 * @return - current SpellCheckerPreferences
	 */
	public SpellCheckerPreferences getPreferences() {
		return currentPreferences;
	}

	/**
	 * Runs the jazzy engine
	 */
	private void performCheck() {
		// Initialize the tokenizer
		IDocument document = currentTarget.getDocument();
		currentTarget.tokenizer.init(document, currentSelection.x,
				currentSelection.y - currentSelection.x, config);
		// Reset the abort flag
		abort = false;
		// Fetch the engine
		SpellChecker engine = getEngine();
		if (engine != null) {
			// Run the engine
			engine.checkSpelling(currentTarget.tokenizer);
			// Reset the spell checking view
			correctionViewer.setInput(null, this, currentTarget.isEditable);
			// Restore original selection
			setSelection(currentSelection.x, currentSelection.y);
			// Done 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产xxx精品视频大全| 麻豆国产欧美一区二区三区| 亚洲一区二区欧美日韩| 久久99国产乱子伦精品免费| 91丨九色porny丨蝌蚪| 欧美一区2区视频在线观看| 欧美国产日产图区| 九九**精品视频免费播放| 色婷婷综合久久久| 久久精品视频网| 日本视频一区二区三区| 国内精品写真在线观看| 精品国产乱码久久久久久闺蜜| 国产女同性恋一区二区| 亚洲aaa精品| 色一情一伦一子一伦一区| 欧美成人r级一区二区三区| 亚洲一区国产视频| 成年人国产精品| 久久这里只有精品6| 性做久久久久久| 欧美主播一区二区三区| 国产精品电影一区二区| 国产一二精品视频| 精品国产乱子伦一区| 婷婷成人激情在线网| 欧美午夜一区二区三区| 亚洲精品中文在线| caoporn国产精品| 中文字幕的久久| 国产成人综合网站| 国产午夜久久久久| 国产麻豆视频精品| 久久久久久久久久电影| 国产精品性做久久久久久| 日韩精品一区二区三区视频播放| 污片在线观看一区二区| 欧美三级中文字幕在线观看| 亚洲一区日韩精品中文字幕| 在线观看不卡视频| 一区二区三区成人| 欧美三级日本三级少妇99| 亚洲成国产人片在线观看| 欧美性受极品xxxx喷水| 亚洲第一狼人社区| 欧美日韩国产在线播放网站| 午夜视频一区二区| 91精品国产综合久久久蜜臀图片| 免费成人在线观看视频| 日韩午夜av电影| 黄网站免费久久| 国产欧美一二三区| 91玉足脚交白嫩脚丫在线播放| 亚洲嫩草精品久久| 7777精品伊人久久久大香线蕉| 麻豆精品一区二区三区| 久久这里只精品最新地址| 国产精品99久久久久久久女警| 亚洲国产精品成人综合色在线婷婷 | 91精品国产全国免费观看| 三级久久三级久久久| 日韩午夜在线观看| 成人美女视频在线观看| 亚洲人123区| 欧美一区二区播放| 成人黄色在线网站| 亚洲图片有声小说| wwwwww.欧美系列| 91啦中文在线观看| 日本欧美肥老太交大片| 国产欧美一区二区三区在线看蜜臀| 色诱视频网站一区| 久热成人在线视频| 亚洲天天做日日做天天谢日日欢 | 亚洲欧美日韩在线不卡| 欧美日韩精品欧美日韩精品一| 精品一区二区精品| 亚洲视频免费观看| 日韩欧美的一区| 92国产精品观看| 免费观看一级欧美片| 中文字幕制服丝袜成人av| 3751色影院一区二区三区| 成人综合日日夜夜| 免费在线观看成人| 亚洲日本va午夜在线影院| 欧美大黄免费观看| 在线观看亚洲一区| 国产传媒久久文化传媒| 日韩电影在线观看网站| 自拍偷拍亚洲综合| 国产欧美一区在线| 日韩欧美电影在线| 欧美猛男gaygay网站| av福利精品导航| 国产一区亚洲一区| 青青草原综合久久大伊人精品 | 亚洲免费色视频| 国产欧美日韩在线看| 67194成人在线观看| 日本乱人伦aⅴ精品| 高清国产午夜精品久久久久久| 蜜臀国产一区二区三区在线播放| 中文字幕亚洲精品在线观看| 国产欧美一二三区| 久久综合色之久久综合| 日韩欧美高清在线| 欧美高清www午色夜在线视频| 91久久精品一区二区二区| 成人av集中营| 成人av资源下载| 国产成人超碰人人澡人人澡| 国产综合久久久久影院| 蜜臀av性久久久久蜜臀av麻豆 | 在线中文字幕不卡| 一本高清dvd不卡在线观看| 成人毛片在线观看| k8久久久一区二区三区| 成人污污视频在线观看| 丰满少妇久久久久久久 | 午夜婷婷国产麻豆精品| 五月天一区二区| 午夜av一区二区三区| 五月婷婷欧美视频| 五月天激情小说综合| 日韩电影在线看| 久久国产精品免费| 国产一区二区三区综合| 国内久久婷婷综合| 国产91丝袜在线观看| 国产很黄免费观看久久| 不卡av在线免费观看| 91丨九色porny丨蝌蚪| 欧美在线观看禁18| 欧美美女视频在线观看| 日韩一级片网址| 欧美精品一区二区三区蜜桃视频| 久久蜜臀精品av| 亚洲欧洲日韩在线| 亚洲一区二区精品视频| 奇米色一区二区三区四区| 国产一区二区精品久久99| 99精品在线免费| 欧美日韩你懂的| 精品国产91亚洲一区二区三区婷婷| 国产午夜三级一区二区三| 国产精品国产三级国产有无不卡| 67194成人在线观看| 国产一区二区三区视频在线播放| 亚洲一区成人在线| 亚洲色图欧美在线| 亚洲大尺度视频在线观看| 丝袜亚洲精品中文字幕一区| 日本中文字幕一区二区视频| 久久精品理论片| 色综合久久天天| 色伊人久久综合中文字幕| 日韩亚洲欧美成人一区| 久久久国际精品| 亚洲美女视频一区| 国产在线精品免费| 不卡的av中国片| 欧美日韩国产高清一区二区| 欧美电视剧免费观看| 亚洲精品中文在线观看| 日韩电影一区二区三区四区| 经典三级在线一区| 成人视屏免费看| 欧美午夜一区二区三区免费大片| 日韩视频在线你懂得| 欧美国产一区在线| 亚洲综合在线视频| 国产福利一区二区| 欧美性xxxxxx少妇| 久久午夜电影网| 一区二区三区在线视频观看58| 国产成人在线观看免费网站| 色综合天天综合色综合av | 国产精品一区二区在线观看网站| 成人激情免费视频| 91精品国产一区二区三区| 综合久久国产九一剧情麻豆| 另类欧美日韩国产在线| 色综合视频在线观看| 久久综合色播五月| 免费看欧美美女黄的网站| www.日韩大片| 欧美日韩一级视频| 久久五月婷婷丁香社区| 亚洲自拍偷拍综合| 成人小视频免费在线观看| 欧美一区二区网站| 夜夜精品视频一区二区| 国产成人精品免费一区二区| 在线播放日韩导航| 自拍视频在线观看一区二区| 欧美aaa在线| 精品卡一卡二卡三卡四在线| 亚洲欧美日韩电影| 国产露脸91国语对白|