站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

TokenContext (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor
Class TokenContext

java.lang.Object
  extended by org.netbeans.editor.TokenContext

public class TokenContext
extends Object

Token context defines the environment in which only a limited set of tokens can be used. This set can be retrieved by calling the getTokenIDs() method. The context can contain other contexts which means that the context can possibly switch into one of its children contexts during lexing. The child context can also have other children that can work in the same way. In this way context-paths can be created. They describe the way how was the token lexically recognized. The context can be retrieved when the syntax-class is known using the get method.


Constructor Summary
TokenContext(String namePrefix)
           
TokenContext(String namePrefix, TokenContext[] children)
          Construct new token-context.
 
Method Summary
protected  void addDeclaredTokenIDs()
          Add all static-final token-id fields declared in this token-context using Class.getDeclaredFields() call.
protected  void addTokenID(TokenID tokenID)
          Add token-id to the set of token-ids that belong to this context.
 TokenContextPath[] getAllContextPaths()
          Get all the context paths for this token-context including itself as the first one and all its children.
 TokenContext[] getChildren()
          Get the children contexts of this context.
 TokenContextPath getContextPath()
          Get the context path for this token-context.
 TokenContextPath getContextPath(TokenContextPath childPath)
          Get the context path for this token-context that is derived from the path of one of the children.
 String getNamePrefix()
          Get the prefix that this context adds to the name of its tokens.
 TokenCategory[] getTokenCategories()
          Get the token-categories that belong to this token-context.
 TokenID[] getTokenIDs()
          Get the token-ids that belong to this token-context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TokenContext

public TokenContext(String namePrefix)

TokenContext

public TokenContext(String namePrefix,
                    TokenContext[] children)
Construct new token-context.

Parameters:
namePrefix - name that will prefix all the token-ids names.
children - child token contexts.
Method Detail

getNamePrefix

public String getNamePrefix()
Get the prefix that this context adds to the name of its tokens.


getChildren

public TokenContext[] getChildren()
Get the children contexts of this context. It returns empty-array if there are no children.


addTokenID

protected void addTokenID(TokenID tokenID)
Add token-id to the set of token-ids that belong to this context.


addDeclaredTokenIDs

protected void addDeclaredTokenIDs()
                            throws IllegalAccessException,
                                   SecurityException
Add all static-final token-id fields declared in this token-context using Class.getDeclaredFields() call.

Throws:
IllegalAccessException
SecurityException

getTokenIDs

public TokenID[] getTokenIDs()
Get the token-ids that belong to this token-context. It doesn't return the children's token-ids.


getTokenCategories

public TokenCategory[] getTokenCategories()
Get the token-categories that belong to this token-context. It doesn't return the children's token-categories.


getContextPath

public TokenContextPath getContextPath()
Get the context path for this token-context.


getContextPath

public TokenContextPath getContextPath(TokenContextPath childPath)
Get the context path for this token-context that is derived from the path of one of the children.


getAllContextPaths

public TokenContextPath[] getAllContextPaths()
Get all the context paths for this token-context including itself as the first one and all its children.


org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.