KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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 java.util.*;
14 import org.eclipse.jface.text.rules.*;
15
16 public class XMLCommentScanner extends RuleBasedScanner {
17
18 public XMLCommentScanner(IColorManager manager) {
19     IToken comment =
20         new Token(new Token(manager.getColor(IPDEColorConstants.P_XML_COMMENT)));
21
22     List rules = new ArrayList();
23
24     // Add rule for comments.
25
rules.add(new MultiLineRule("<!--", "-->", comment)); //$NON-NLS-1$ //$NON-NLS-2$
26

27     IRule[] result = new IRule[rules.size()];
28     rules.toArray(result);
29     setRules(result);
30 }
31 }
32
Popular Tags