xmlscanner.java

来自「一个eclipse插件源代码。用于web开发」· Java 代码 · 共 60 行

JAVA
60
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/editors/XMLScanner.java,v 1.1.1.1 2004/07/01 09:07:41 wang_j Exp $
 * $Revision: 1.1.1.1 $
 * $Date: 2004/07/01 09:07:41 $
 *
 * ====================================================================
 *
 * The NanJing HopeRun(IT-FOREST) Software License, Version 2.0.0
 *
 * Copyright 2003-2004 by NanJing HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and
 *                        IT Forest Corporation
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 * You shall not disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into with
 * HopeRun(IT-FOREST) Information System Co., Ltd, CHINA and IT Forest Corporation.
 */
package com.webpump.ui.bind.editors;

import org.eclipse.jface.text.rules.*;
import org.eclipse.jface.text.*;
/**
 * Class which scanner the document for particular part of the document in the editor 
 * 
 * @author zhang_tx
 * @version 2.0.0 2004-2-13
 */
public class XMLScanner extends RuleBasedScanner {
	/** the contributor of the XMLScanner,which declares 
	 * some rules for particular part for the doucment to display 
	 * it's text with particular color 
	 */
	public XMLScanner(ColorManager manager) {
		IToken procInstr =
			new Token(
				new TextAttribute(
					manager.getColor(IXMLColorConstants.PROC_INSTR)));

		IToken test =
			new Token(
				new TextAttribute(
					manager.getColor(IXMLColorConstants.TEST)));
		IToken jspcontents =
			new Token(
				new TextAttribute(
					manager.getColor(IXMLColorConstants.JSP_CONTENTS)));
		IRule[] rules = new IRule[4];
		//Add rule for processing instructions
		rules[0] = new SingleLineRule("<?", "?>", procInstr);
		rules[1] = new SingleLineRule("##", "##",test);
		rules[2] = new SingleLineRule("<?=", "?>",jspcontents);
		// Add generic whitespace rule.
		rules[3] = new WhitespaceRule(new XMLWhitespaceDetector());

		setRules(rules);
	}
}

⌨️ 快捷键说明

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