KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > properties > syntax > PropertiesTokenContext


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.properties.syntax;
21
22 import org.netbeans.editor.BaseTokenID;
23 import org.netbeans.editor.TokenContext;
24 import org.netbeans.editor.TokenContextPath;
25
26 /**
27 * Token-ids and token-categories defined
28 * for the properties syntax.
29 *
30 * @author Miloslav Metelka
31 * @version 1.00
32 */

33
34 public class PropertiesTokenContext extends TokenContext {
35
36     // Token numeric-IDs
37
public static final int TEXT_ID = 1; // plain text
38
public static final int LINE_COMMENT_ID = 2; // line comment
39
public static final int KEY_ID = 3; // key
40
public static final int EQ_ID = 4; // equal-sign
41
public static final int VALUE_ID = 5; // value
42
public static final int EOL_ID = 6; // EOL
43

44     // TokenIDs
45
public static final BaseTokenID TEXT
46     = new BaseTokenID("text", TEXT_ID);
47     public static final BaseTokenID LINE_COMMENT
48     = new BaseTokenID("line-comment", LINE_COMMENT_ID);
49     public static final BaseTokenID KEY
50     = new BaseTokenID("key", KEY_ID);
51     public static final BaseTokenID EQ
52     = new BaseTokenID("equal-sign", EQ_ID);
53     public static final BaseTokenID VALUE
54     = new BaseTokenID("value", VALUE_ID);
55     public static final BaseTokenID EOL
56     = new BaseTokenID("EOL", EOL_ID);
57
58
59     // Context instance declaration
60
public static final PropertiesTokenContext context = new PropertiesTokenContext();
61
62     public static final TokenContextPath contextPath = context.getContextPath();
63
64     private PropertiesTokenContext() {
65         super("properties-");
66
67         try {
68             addDeclaredTokenIDs();
69         } catch (Exception JavaDoc e) {
70             if (Boolean.getBoolean("netbeans.debug.exceptions")) { // NOI18N
71
e.printStackTrace();
72             }
73         }
74
75     }
76
77 }
78
79
Popular Tags