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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? spellcorrectionview.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.views;import java.util.List;import org.eclipse.jface.action.*;import org.eclipse.jface.viewers.*;import org.eclipse.swt.SWT;import org.eclipse.swt.events.KeyAdapter;import org.eclipse.swt.events.KeyEvent;import org.eclipse.swt.events.ModifyEvent;import org.eclipse.swt.events.ModifyListener;import org.eclipse.swt.graphics.Image;import org.eclipse.swt.layout.GridData;import org.eclipse.swt.layout.GridLayout;import org.eclipse.swt.widgets.Composite;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.Menu;import org.eclipse.swt.widgets.Text;import org.eclipse.ui.IActionBars;import org.eclipse.ui.help.WorkbenchHelp;import org.eclipse.ui.part.ViewPart;import com.bdaum.SpellChecker.SpellCheckManager;import com.bdaum.SpellChecker.SpellCheckerImages;import com.bdaum.SpellChecker.SpellCheckerPlugin;import com.bdaum.SpellChecker.actions.CheckSpellingActionDelegate;import com.bdaum.SpellChecker.actions.CorrectionViewAction;import com.swabunga.spell.engine.Word;import com.swabunga.spell.event.SpellCheckEvent;import com.bdaum.SpellChecker.Messages;public class SpellCorrectionView extends ViewPart {	// Text constant for cases where we have no correction proposals	private static final String[] NOPROPOSALS = new String[] { Messages			.getString("SpellCorrectionView.No_suggestions") };	/* Widgets */	// The current Display instance	private Display display;	// The Text widget for displaying the bad word	private Text badWord;	// The TableViewer of this view	private TableViewer viewer;	/* View actions */	// Toolbar and menu actions	private IAction ignoreAction;	private IAction ignoreAllAction;	private IAction cancelAction;	private IAction replaceAction;	private IAction replaceAllAction;	private IAction addToDictionaryAction;	// The double click action	private Action doubleClickAction;	/* The manager */	private SpellCheckManager spellCheckManager;	/* The current spelling error event */	private SpellCheckEvent currentEvent;	/* Indicator if replacements are allowed */	private boolean documentIsEditable;	/**	 * The ViewContentProvider creates the table content from the spelling error	 * event.	 */	class ViewContentProvider implements IStructuredContentProvider {		// Current spelling error event		private Object spEvent;		/**		 * This method is called by the TableViewer after setInput() was called.		 */		public void inputChanged(Viewer v, Object oldInput, Object newInput) {			spEvent = newInput;		}		/**		 * This method is called when the table is refreshed		 */		public Object[] getElements(Object parent) {			// Fetch correction proposals from the spelling error event			if (spEvent instanceof SpellCheckEvent) {				List suggestions = ((SpellCheckEvent) spEvent).getSuggestions();				int s = suggestions.size();				// Check if we have proposals				if (s > 0) {					// Return correction proposals as an array to the					// TableViewer					Word[] sugArray = new Word[s];					suggestions.toArray(sugArray);					return sugArray;				}			}			return NOPROPOSALS;		}		public void dispose() {		}	}	/**	 * The ViewLabelProvider creates the individual table entries	 */	class ViewLabelProvider extends LabelProvider implements			ITableLabelProvider {		/*		 * Process text for table entry		 */		public String getColumnText(Object obj, int index) {			return getText(obj);		}		public Image getColumnImage(Object obj, int index) {			return null;		}		public Image getImage(Object obj) {			return null;		}	}	public void createPartControl(Composite parent) {		// Fetch Display instance for later usage		display = parent.getDisplay();		// Set GridLayout		parent.setLayout(new GridLayout());		// Create Text widget for display of bad word		badWord = new Text(parent, SWT.BORDER);		badWord.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));		// Disable/Enable actions when content of text field changes		badWord.addModifyListener(new ModifyListener() {			public void modifyText(ModifyEvent e) {				updateActionEnablement();			}		});		// Create table viewer		viewer = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL				| SWT.BORDER);		viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));		// Set ContentProvider and LabelProvider		viewer.setContentProvider(new ViewContentProvider());		viewer.setLabelProvider(new ViewLabelProvider());		// Listener for selection of table elements		// Selected elements are copied to text field badWord.		viewer.addSelectionChangedListener(new ISelectionChangedListener() {			public void selectionChanged(SelectionChangedEvent event) {				ISelection sel = event.getSelection();				if (sel instanceof IStructuredSelection) {					Object obj = ((IStructuredSelection) sel).getFirstElement();					// Check for Word type to exclude NOPROPOSALS					// from selection					if (obj instanceof Word)						badWord.setText(obj.toString());				}			}		});		// Add KeyListener to support keyboard shortcuts		viewer.getControl().addKeyListener(new KeyAdapter() {			public void keyPressed(KeyEvent e) {				if (e.character == '+')					addToDictionaryAction.run();				else					switch (e.keyCode) {					case 13:						if ((e.stateMask & SWT.CTRL) != 0) {							if ((e.stateMask & SWT.SHIFT) != 0)								replaceAllAction.run();							else								replaceAction.run();						} else {							if ((e.stateMask & SWT.SHIFT) != 0)								ignoreAllAction.run();							else								ignoreAction.run();						}						break;					case SWT.ESC:						cancelAction.run();						break;					}			}		});		// Create actions		makeActions();		// Add the context menu		hookContextMenu();		// Add the double click action		hookDoubleClickAction();		// Create the toolbar		contributeToActionBars();		// Initialize the actions		updateActionEnablement();		// Create help context		WorkbenchHelp.setHelp(parent,				"com.bdaum.SpellChecker.correctionView_context");	}	/**	 * Set focus to TableViewer	 */	public void setFocus() {		viewer.getControl().setFocus();	}	// Add double click action	private void hookDoubleClickAction() {		viewer.addDoubleClickListener(new IDoubleClickListener() {			public void doubleClick(DoubleClickEvent event) {				doubleClickAction.run();			}		});	}	// Add context menu	private void hookContextMenu() {		// Create new menu manager		MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$		// Remove all menu items before building the menu		menuMgr.setRemoveAllWhenShown(true);		// Event processing for context menu		menuMgr.addMenuListener(new IMenuListener() {			public void menuAboutToShow(IMenuManager manager) {				SpellCorrectionView.this.fillContribution(manager);			}		});		// Create menu		Menu menu = menuMgr.createContextMenu(viewer.getControl());		viewer.getControl().setMenu(menu);		// Register context menu with workbench site		getSite().registerContextMenu(menuMgr, viewer);	}	private void contributeToActionBars() {		// Fetch action bar from workbench site		IActionBars bars = getViewSite().getActionBars();		// Create the drop-down menu		fillContribution(bars.getMenuManager());		// Create the toolbar		fillContribution(bars.getToolBarManager());	}	// Fill menus or toolbar with actions	private void fillContribution(IContributionManager manager) {		manager.add(replaceAction);		manager.add(replaceAllAction);		manager.add(new Separator());		manager.add(addToDictionaryAction);		manager.add(new Separator());		manager.add(ignoreAction);		manager.add(ignoreAllAction);		manager.add(cancelAction);		// Other plug-ins can insert new actions here		manager.add(new Separator("Additions"));	}	// Create actions	private void makeActions() {		replaceAction = createAction(CorrectionViewAction.REPLACE, Messages				.getString("SpellCorrectionView.Replace"), Messages				.getString("SpellCorrectionView.Replace_occurrence"),				SpellCheckerImages.IMG_REPLACE);		replaceAllAction = createAction(				CorrectionViewAction.REPLACEALL,				Messages.getString("SpellCorrectionView.Replace_all"),				Messages						.getString("SpellCorrectionView.Replace_all_occurrences"),				SpellCheckerImages.IMG_REPLACEALL);		addToDictionaryAction = createAction(CorrectionViewAction.ADD, Messages				.getString("SpellCorrectionView.Add_to_dictionary"), Messages				.getString("SpellCorrectionView.Add_word_to_dictionary"),				SpellCheckerImages.IMG_ADDTODICTIONARY);		ignoreAction = createAction(CorrectionViewAction.IGNORE, Messages				.getString("SpellCorrectionView.Ignore"), Messages				.getString("SpellCorrectionView.Ignore_spelling_problem"),				SpellCheckerImages.IMG_IGNORE);		ignoreAllAction = createAction(CorrectionViewAction.IGNOREALL, Messages				.getString("SpellCorrectionView.Ignore_all"), Messages				.getString("SpellCorrectionView.Ignore_for_all_occurrences"),				SpellCheckerImages.IMG_IGNOREALL);		cancelAction = createAction(CorrectionViewAction.CANCEL, Messages				.getString("SpellCorrectionView.StartCancel"), Messages				.getString("SpellCorrectionView.StartCancel_spell_checking"),				SpellCheckerImages.IMG_CANCEL);		doubleClickAction = new CorrectionViewAction(this,				CorrectionViewAction.DOUBLECLICK);	}	// Create a single action	private IAction createAction(int operation, String label, String toolTip,			String imageID) {		IAction action = new CorrectionViewAction(this, operation);		action.setText(label);		action.setToolTipText(toolTip);		SpellCheckerImages.setImageDescriptors(action, "lcl16", imageID);		return action;	}	/**	 * Perform operation for an action	 * 	 * @param operation -	 *            the operation code	 */	public void performOperation(int operation) {		if (currentEvent == null) {			if (operation == CorrectionViewAction.CANCEL)				// Start spell checking via action delegate				SpellCheckerPlugin.getSpellCheckingActionDelegate().run(null);			return;		}		switch (operation) {		case CorrectionViewAction.DOUBLECLICK:			if (!documentIsEditable)				return;			ISelection selection = viewer.getSelection();			Object obj = ((IStructuredSelection) selection).getFirstElement();			if (!(obj instanceof Word))				return;			currentEvent.replaceWord(obj.toString(), false);			break;		case CorrectionViewAction.REPLACE:			currentEvent.replaceWord(badWord.getText(), false);			break;		case CorrectionViewAction.REPLACEALL:			if (!documentIsEditable)				return;			currentEvent.replaceWord(badWord.getText(), true);			break;		case CorrectionViewAction.ADD:			String newWord = badWord.getText();			String originalBadWord = currentEvent.getInvalidWord();			if (!documentIsEditable && !originalBadWord.equals(newWord))				return;			currentEvent.addToDictionary(newWord);			break;		case CorrectionViewAction.IGNORE:			currentEvent.ignoreWord(false);			break;		case CorrectionViewAction.IGNOREALL:			currentEvent.ignoreWord(true);			break;		case CorrectionViewAction.CANCEL:			currentEvent.cancel();			break;		}		signalEventProcessed();	}	// Signal end of event processing	private void signalEventProcessed() {		// Release waiting manager		spellCheckManager.continueSpellChecking();		// Reset current event		currentEvent = null;		// Update viewer		updateView();	}	/**	 * Update actions. Most of the actions are disabled when no more events are	 * pending. The cancel action, however, now acts as a start action.	 */	public void updateActionEnablement() {		boolean pendingEvent = (currentEvent != null);		// Enable or disable actions		if (pendingEvent & documentIsEditable) {			boolean modified = !currentEvent.getInvalidWord().equals(					badWord.getText());			replaceAction.setEnabled(modified);			replaceAllAction.setEnabled(modified);		} else {			replaceAction.setEnabled(false);			replaceAllAction.setEnabled(false);		}		ignoreAction.setEnabled(pendingEvent);		ignoreAllAction.setEnabled(pendingEvent);		addToDictionaryAction.setEnabled(pendingEvent);		// Update cancel action		if (pendingEvent) {			SpellCheckerImages.setImageDescriptors(cancelAction, "lcl16",					SpellCheckerImages.IMG_CANCEL);			cancelAction.setChecked(true);			cancelAction.setToolTipText(Messages					.getString("SpellCorrectionView.Cancel_spell_checking"));			cancelAction.setEnabled(true);		} else {			SpellCheckerImages.setImageDescriptors(cancelAction, "lcl16",					SpellCheckerImages.IMG_CHECK);			cancelAction.setChecked(false);			cancelAction.setToolTipText(Messages					.getString("SpellCorrectionView.Start_spell_checking"));			CheckSpellingActionDelegate delegate = SpellCheckerPlugin					.getSpellCheckingActionDelegate();			cancelAction.setEnabled(delegate != null && delegate.isEnabled());		}	}	// Update view	private void updateView() {		// Execute via syncExec as we are called from other thread		display.syncExec(new Runnable() {			public void run() {				// Update TableViewer				viewer.setInput(currentEvent);				// Update Text field and title				if (currentEvent == null) {					badWord.setText("");					setContentDescription(spellCheckManager.getCurrentName()							+ Messages.getString("SpellCorrectionView.done"));				} else {					badWord.setText(currentEvent.getInvalidWord());					setContentDescription(spellCheckManager.getCurrentName()							+ Messages									.getString("SpellCorrectionView.in_progress"));				}				// Update actions				updateActionEnablement();			}		});	}	/**	 * Indicate that we are loading a dictionary	 */	public void indicateLoading(final String name) {		display.syncExec(new Runnable() {			public void run() {				setContentDescription(name						+ Messages.getString("SpellCorrectionView.loading"));			}		});	}	/**	 * Supplies the Spell Correction View with a new spelling error event	 * 	 * @param event -	 *            the spelling error event	 * @param manager -	 *            the manager to be notified when finished	 * @param documentIsEditable -	 *            true, if document may be modified	 */	public void setInput(SpellCheckEvent event, SpellCheckManager manager,			boolean documentIsEditable) {		// Accept event, manager, and flag		this.currentEvent = event;		this.spellCheckManager = manager;		this.documentIsEditable = documentIsEditable;		// Update the view		updateView();	}}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产免费久久| 国产91精品在线观看| 亚洲免费观看高清完整| 亚洲美女一区二区三区| 亚洲资源中文字幕| 日韩成人一区二区| 国产麻豆午夜三级精品| 色视频一区二区| 这里只有精品电影| 久久久精品影视| 一区二区三区毛片| 国产在线视频一区二区三区| 色又黄又爽网站www久久| 精品理论电影在线观看| 亚洲欧美日韩国产另类专区| 久久精品国产亚洲5555| 色哦色哦哦色天天综合| 精品国产一区二区三区不卡| 亚洲视频网在线直播| 日韩1区2区3区| 国产成人精品免费| 日韩欧美在线网站| 日韩理论片网站| 精品制服美女丁香| 在线观看亚洲精品视频| 国产亚洲精品bt天堂精选| 奇米精品一区二区三区在线观看 | 亚洲精品国产第一综合99久久| 日本网站在线观看一区二区三区| 99久久精品免费看国产免费软件| 欧美成人激情免费网| 亚洲一区二区三区免费视频| 不卡免费追剧大全电视剧网站| 欧美成人女星排名| 亚洲123区在线观看| 色一情一乱一乱一91av| 欧美激情一区二区三区蜜桃视频 | 欧美日韩国产bt| 亚洲欧洲一区二区三区| 国产伦精品一区二区三区在线观看| 欧美色视频在线观看| 日韩理论片一区二区| www.亚洲国产| 国产精品久久免费看| 粉嫩aⅴ一区二区三区四区| 欧美精品一区男女天堂| 九九视频精品免费| 精品欧美乱码久久久久久1区2区 | 亚洲福中文字幕伊人影院| zzijzzij亚洲日本少妇熟睡| 国产欧美在线观看一区| 国产麻豆成人精品| 欧美韩日一区二区三区| 福利一区在线观看| 国产精品久久看| 99久久婷婷国产综合精品电影| 中国av一区二区三区| 99re成人精品视频| 亚洲精品国产品国语在线app| 蜜桃视频免费观看一区| 国产一区二区福利| 美女脱光内衣内裤视频久久网站 | 国产网站一区二区三区| 91性感美女视频| 春色校园综合激情亚洲| 日韩av一级电影| 日韩黄色免费电影| 欧美性极品少妇| 亚洲一区二区三区自拍| 欧美三级蜜桃2在线观看| 亚洲国产日韩a在线播放性色| 色婷婷av一区二区| 亚洲成人免费影院| 欧美一区二区播放| 精品亚洲成av人在线观看| 欧美激情综合网| 色久综合一二码| 日本亚洲欧美天堂免费| 精品成人a区在线观看| 久草精品在线观看| 国产精品国产自产拍高清av| 91香蕉视频污在线| 午夜视频久久久久久| 欧美不卡在线视频| 国产成人av一区| 一区二区三区色| 欧美一级日韩不卡播放免费| 丁香一区二区三区| 亚洲va在线va天堂| 久久精品亚洲乱码伦伦中文| 色综合亚洲欧洲| 日本成人在线不卡视频| 国产女人aaa级久久久级 | 国产精品免费网站在线观看| 91在线视频官网| 天天av天天翘天天综合网色鬼国产| 日韩欧美视频一区| 99re这里只有精品首页| 日韩av一区二| 自拍偷拍国产亚洲| 日韩精品中文字幕在线不卡尤物| 成人aaaa免费全部观看| 日韩国产欧美一区二区三区| 亚洲欧洲av在线| 欧美成人一区二区三区片免费| 色综合色综合色综合| 国产精品亚洲视频| 亚洲综合在线观看视频| 精品国产99国产精品| 欧美日韩国产精品自在自线| 成人午夜碰碰视频| 美女任你摸久久| 亚洲图片欧美一区| 国产精品欧美一区二区三区| 日韩视频一区二区三区在线播放| 青青草97国产精品免费观看无弹窗版 | 色哟哟国产精品| 国产在线不卡视频| 热久久国产精品| 亚洲国产精品一区二区久久| 久久九九久精品国产免费直播| 欧美日高清视频| 色国产精品一区在线观看| 高清shemale亚洲人妖| 国产乱码精品一区二区三| 免费成人在线影院| 日韩一区精品字幕| 亚洲成av人综合在线观看| 中文字幕一区在线| 国产精品久久久久久久午夜片| 久久久亚洲综合| 久久天天做天天爱综合色| 日韩久久精品一区| 日韩免费性生活视频播放| 欧美精品一二三四| 欧美日韩午夜在线视频| 欧美性色黄大片| 色婷婷综合久久| 91免费观看视频| 色一情一伦一子一伦一区| 91最新地址在线播放| 不卡视频在线观看| 91在线观看成人| 91官网在线观看| 欧美日韩久久不卡| 欧美一区二区在线看| 91精品啪在线观看国产60岁| 欧美一区二区在线不卡| 日韩午夜激情视频| 精品国产伦一区二区三区观看体验| 日韩精品一区在线观看| 2019国产精品| 亚洲国产精华液网站w| 一区在线中文字幕| 亚洲精品v日韩精品| 亚洲风情在线资源站| 蜜臀av性久久久久蜜臀av麻豆| 国产自产视频一区二区三区| 国产99久久久久| 91免费观看国产| 欧美一区二区在线不卡| 久久久久国产一区二区三区四区| 国产欧美一区二区三区在线老狼| 一色屋精品亚洲香蕉网站| 亚洲电影你懂得| 久久99国产精品久久99| 粉嫩欧美一区二区三区高清影视| 91蝌蚪porny| 制服视频三区第一页精品| 国产调教视频一区| 亚洲精品水蜜桃| 蜜臀av在线播放一区二区三区| 国产精品99久久久久久久女警 | 欧美日韩成人综合天天影院 | 国产成人自拍网| 色偷偷久久一区二区三区| 7777精品久久久大香线蕉| 久久久久久免费网| 一区二区三区在线看| 另类小说欧美激情| 色综合视频一区二区三区高清| 欧美精品九九99久久| 欧美国产日本视频| 五月天激情综合| 成人黄色av电影| 91精品国产一区二区| 国产精品免费视频一区| 婷婷综合在线观看| 成人精品视频一区二区三区| 91精品一区二区三区久久久久久| 国产精品精品国产色婷婷| 久久99久久久久| 欧美一a一片一级一片| 国产午夜精品理论片a级大结局| 亚洲bt欧美bt精品| 99综合电影在线视频| 精品女同一区二区| 午夜私人影院久久久久| 99国产精品99久久久久久| 久久免费电影网|