01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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.pde.internal.ui.editor.text;
11:
12: import org.eclipse.jface.text.rules.IPredicateRule;
13: import org.eclipse.jface.text.rules.MultiLineRule;
14: import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
15: import org.eclipse.jface.text.rules.Token;
16:
17: public class XMLPartitionScanner extends RuleBasedPartitionScanner {
18: public final static String XML_COMMENT = "__xml_comment"; //$NON-NLS-1$
19: public final static String XML_TAG = "__xml_tag"; //$NON-NLS-1$
20:
21: public static final String[] PARTITIONS = new String[] {
22: XML_COMMENT, XML_TAG };
23:
24: public XMLPartitionScanner() {
25: IPredicateRule[] rules = new IPredicateRule[2];
26: rules[0] = new MultiLineRule(
27: "<!--", "-->", new Token(XML_COMMENT), '\\', true); //$NON-NLS-1$ //$NON-NLS-2$
28: rules[1] = new XMLTagRule(new Token(XML_TAG));
29: setPredicateRules(rules);
30: }
31: }
|