01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.templateeditor.editors;
11:
12: import org.eclipse.jface.text.rules.*;
13: import org.eclipse.jface.text.*;
14:
15: public class XMLScanner extends RuleBasedScanner {
16:
17: public XMLScanner(ColorManager manager) {
18: IToken procInstr = new Token(new TextAttribute(manager
19: .getColor(IXMLColorConstants.PROC_INSTR)));
20:
21: IRule[] rules = new IRule[2];
22: //Add rule for processing instructions
23: rules[0] = new SingleLineRule("<?", "?>", procInstr); //$NON-NLS-1$//$NON-NLS-2$
24: // Add generic whitespace rule.
25: rules[1] = new WhitespaceRule(new XMLWhitespaceDetector());
26:
27: setRules(rules);
28: }
29: }
|