sysmodelmgr/com.symbian.smt.gui/src/com/symbian/smt/gui/editors/xmleditor/TagRule.java
equal
deleted
inserted
replaced
|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 package com.symbian.smt.gui.editors.xmleditor; |
|
19 |
|
20 import org.eclipse.jface.text.rules.ICharacterScanner; |
|
21 import org.eclipse.jface.text.rules.IToken; |
|
22 import org.eclipse.jface.text.rules.MultiLineRule; |
|
23 |
|
24 /** |
|
25 * @author barbararosi-schwartz |
|
26 * |
|
27 */ |
|
28 public class TagRule extends MultiLineRule { |
|
29 |
|
30 public TagRule(IToken token) { |
|
31 super("<", ">", token); |
|
32 } |
|
33 |
|
34 protected boolean sequenceDetected(ICharacterScanner scanner, |
|
35 char[] sequence, boolean eofAllowed) { |
|
36 int c = scanner.read(); |
|
37 if (sequence[0] == '<') { |
|
38 if (c == '?') { |
|
39 // processing instruction - abort |
|
40 scanner.unread(); |
|
41 return false; |
|
42 } |
|
43 if (c == '!') { |
|
44 scanner.unread(); |
|
45 // comment - abort |
|
46 return false; |
|
47 } |
|
48 } else if (sequence[0] == '>') { |
|
49 scanner.unread(); |
|
50 } |
|
51 return super.sequenceDetected(scanner, sequence, eofAllowed); |
|
52 } |
|
53 } |