KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > lexer > LexerApiPackageAccessor


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.lib.lexer;
21
22 import org.netbeans.api.lexer.Language;
23 import org.netbeans.api.lexer.TokenChange;
24 import org.netbeans.api.lexer.TokenHierarchyEvent;
25 import org.netbeans.api.lexer.TokenHierarchy;
26 import org.netbeans.api.lexer.TokenId;
27 import org.netbeans.lib.lexer.inc.TokenChangeInfo;
28 import org.netbeans.lib.lexer.inc.TokenHierarchyEventInfo;
29 import org.netbeans.spi.lexer.LanguageHierarchy;
30
31
32 /**
33  * Accessor for the package-private functionality in org.netbeans.api.editor.fold.
34  *
35  * @author Miloslav Metelka
36  * @version 1.00
37  */

38
39 public abstract class LexerApiPackageAccessor {
40     
41     private static LexerApiPackageAccessor INSTANCE;
42     
43     public static LexerApiPackageAccessor get() {
44         return INSTANCE;
45     }
46
47     /**
48      * Register the accessor. The method can only be called once
49      * - othewise it throws IllegalStateException.
50      *
51      * @param accessor instance.
52      */

53     public static void register(LexerApiPackageAccessor accessor) {
54         if (INSTANCE != null) {
55             throw new IllegalStateException JavaDoc("Already registered"); // NOI18N
56
}
57         INSTANCE = accessor;
58     }
59     
60     public abstract <T extends TokenId> Language<T> createLanguage(
61     LanguageHierarchy<T> languageHierarchy);
62
63     public abstract <T extends TokenId> LanguageHierarchy<T> languageHierarchy(
64     Language<T> language);
65
66     public abstract <I> TokenHierarchy<I> createTokenHierarchy(
67     TokenHierarchyOperation<I,?> tokenHierarchyOperation);
68     
69     public abstract TokenHierarchyEvent createTokenChangeEvent(
70     TokenHierarchyEventInfo info);
71     
72     public abstract <T extends TokenId> TokenChange<T> createTokenChange(
73     TokenChangeInfo<T> info);
74     
75     public abstract <T extends TokenId> TokenChangeInfo<T> tokenChangeInfo(
76     TokenChange<T> tokenChange);
77     
78     public abstract <I> TokenHierarchyOperation<I,?> tokenHierarchyOperation(
79     TokenHierarchy<I> tokenHierarchy);
80     
81 }
82
Popular Tags