xmlpartitionscanner.java

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

JAVA
88
字号
/*
 * $Header: /home/cvs/WEBPUMP2.0/WebPumpIDE_Src/WebPumpIDE/src/com/webpump/ui/bind/editors/XMLPartitionScanner.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.*;

/**
 * Class which scanner the document for particular partition of the editor 
 * 
 * @author zhang_tx
 * @version 2.0.0 2004-2-13
 */
public class XMLPartitionScanner extends RuleBasedPartitionScanner {
	/** default color of the document */
	public final static String XML_DEFAULT = "__xml_default";
	/** the color of the five html bind tags */
	public final static String XML_COMMENT = "__xml_comment";
	/** the color of the three inner error bind tags */
	public final static String XML_ERRORS = "__xml_errors";
	/** the color of the other two inner bind tags */
	public final static String XML_COMPONENTS = "__xml_components";
	/** the color of the tag */
	public final static String XML_TAG = "__xml_tag";
	/** the color of the parameter bind tag "##parameter##" */
	public final static String TEST = "__test";
	/** the color of the string used in the jsp files */
	public final static String JSP_CONTENTS = "__jsp_contents";

    /** the contributor of the XMLPartitionScanner,which declares 
     * some rules for particular part for the doucment to display 
     * it's text with particular color 
     */
	public XMLPartitionScanner() {

		IToken xmlComment = new Token(XML_COMMENT);
		IToken xmlErrors = new Token(XML_ERRORS);
		IToken xmlComponents = new Token(XML_COMPONENTS);
		IToken jspcontents = new Token(JSP_CONTENTS);
		IToken tag = new Token(XML_TAG);
		IToken test = new Token(TEST);

		IPredicateRule[] rules = new IPredicateRule[22];
//		Add rule for processing instructions
		rules[0] = new MultiLineRule("##","##",test);
		rules[1] = new SingleLineRule("##","##",test);
		rules[2] = new SingleLineRule("<!--WebPumpTools[Script] ", "-->", xmlComment);
		rules[3] = new SingleLineRule("<!--End of WebPumpTools[Script] ", "-->", xmlComment);
		rules[4] = new SingleLineRule("<!--WebPumpTools[Style] ", "-->", xmlComment);
		rules[5] = new SingleLineRule("<!--End of WebPumpTools[Style] ", "-->", xmlComment);
		rules[6] = new SingleLineRule("<!--WebPumpTools[BodyHeader] ", "-->", xmlComment);
		rules[7] = new SingleLineRule("<!--End of WebPumpTools[BodyHeader] ", "-->", xmlComment);
		rules[8] = new SingleLineRule("<!--WebPumpTools[DrawScene] ", "-->", xmlComment);
		rules[9] = new SingleLineRule("<!--End of WebPumpTools[DrawScene] ", "-->", xmlComment);
		rules[10] = new SingleLineRule("<!--WebPumpTools[TailScript] ", "-->", xmlComment);
		rules[11] = new SingleLineRule("<!--End of WebPumpTools[TailScript] ", "-->", xmlComment);
		rules[12] = new SingleLineRule("<!--WEBPUMPCOMPONET ERRORNAME=", "TYPE=\"SingleErrorComponent\" -->", xmlErrors);
		rules[13] = new SingleLineRule("<!--WEBPUMPCOMPONET ERRORNAME=", "TYPE=\"FirstErrorComponent\" -->", xmlErrors);
		rules[14] = new SingleLineRule("<!--WEBPUMPCOMPONET ERRORNAME=", "TYPE=\"AllErrorComponent\" -->", xmlErrors);
		rules[15] = new SingleLineRule("<!--WEBPUMPCOMPONET ", "TYPE=\"LoopComponent\" -->", xmlComponents);
		rules[16] = new SingleLineRule("<!--WEBPUMPCOMPONET ", "TYPE=\"CustomerComponent\" -->", xmlComponents);
		rules[17] = new SingleLineRule("<!--/WEBPUMPCOMPONET[ERRORS]", "-->", xmlErrors);
		rules[18] = new SingleLineRule("<!--/WEBPUMPCOMPONET[LOOP]", "-->",xmlComponents);
		rules[19] = new SingleLineRule("<!--/WEBPUMPCOMPONET[CUSTOMER]", "-->",xmlComponents);
		rules[20] = new SingleLineRule("<%=","%>",jspcontents);
		rules[21] = new TagRule(tag);


		setPredicateRules(rules);
	}
}

⌨️ 快捷键说明

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