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.*;
13: import org.eclipse.jface.text.rules.*;
14:
15: public class XMLTagScanner extends RuleBasedScanner {
16:
17: public XMLTagScanner(ColorManager manager) {
18: IToken string = new Token(new TextAttribute(manager
19: .getColor(IXMLColorConstants.STRING)));
20:
21: IRule[] rules = new IRule[3];
22:
23: // Add rule for double quotes
24: rules[0] = new SingleLineRule("\"", "\"", string, '\\'); //$NON-NLS-1$//$NON-NLS-2$
25: // Add a rule for single quotes
26: rules[1] = new SingleLineRule("'", "'", string, '\\'); //$NON-NLS-1$//$NON-NLS-2$
27: // Add generic whitespace rule.
28: rules[2] = new WhitespaceRule(new XMLWhitespaceDetector());
29:
30: setRules(rules);
31: }
32: }
|