KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > editor > text > XMLPartitionScanner


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.editor.text;
12
13 import org.eclipse.jface.text.rules.IPredicateRule;
14 import org.eclipse.jface.text.rules.MultiLineRule;
15 import org.eclipse.jface.text.rules.RuleBasedPartitionScanner;
16 import org.eclipse.jface.text.rules.Token;
17
18 public class XMLPartitionScanner extends RuleBasedPartitionScanner {
19     public final static String JavaDoc XML_COMMENT = "__xml_comment"; //$NON-NLS-1$
20
public final static String JavaDoc XML_TAG = "__xml_tag"; //$NON-NLS-1$
21

22     public static final String JavaDoc[] PARTITIONS = new String JavaDoc[] {XML_COMMENT, XML_TAG};
23     
24     public XMLPartitionScanner() {
25         IPredicateRule[] rules = new IPredicateRule[2];
26         rules[0] = new MultiLineRule("<!--", "-->", new Token(XML_COMMENT), '\\', true); //$NON-NLS-1$ //$NON-NLS-2$
27
rules[1] = new XMLTagRule(new Token(XML_TAG));
28         setPredicateRules(rules);
29     }
30 }
31
Popular Tags