Extension SDK 10.1.2

oracle.javatools.editor.language
Interface LanguageSupport

All Known Implementing Classes:
AbstractLanguageSupport

public interface LanguageSupport

The LanguageSupport interface is essentially a directory listing for language-specific support services such as syntax highlighting or formatting for a given language. Each instance is associated with a single document. This allows various actions and view renderers to share the same services (such as a scanner for auto-indentation.)

Note, the various services provided by a single LanguageSupport instance, such as the DocumentRenderer, is not intended to be used by multiple clients simultaneously. An example of this incorrect usage would be for a renderer and formatter to be using the same Scanner provided by the LanguageSupport. For now, there are no plans in place for enforcing this policy.

See Also:
LanguageRegistry, LanguageModule

Field Summary
static java.lang.String PROPERTY_LINE_COMMENT_START
          The name of the language-specific property for characters used to start a line comment.
 
Method Summary
 void deinstall()
          Disassociates this instance from a specific document.
 BraceProvider getBraceProvider()
          Fetches the BraceProvider for performing brace matching for this document.
 BasicDocument getDocument()
          Fetches the document associated with this LanguageSupport instance.
 DocumentRenderer getDocumentRenderer()
          Fetches the DocumentRenderer for rendering the given document.
 java.lang.Object getProperty(java.lang.String key)
          Fetch the language-specific properties.
 SmartIndentProvider getSmartIndentProvider()
          Fetches the SmartIndentProvider to use for performing smart indentation.
 WordLocator getWordLocator()
          Fetches the WordLocator to use for locating word boundaries for word-based navigator.
 void install(BasicDocument document)
          Associates this LanguageSupport instance with a specific document.
 

Field Detail

PROPERTY_LINE_COMMENT_START

public static final java.lang.String PROPERTY_LINE_COMMENT_START
The name of the language-specific property for characters used to start a line comment.

See Also:
Constant Field Values
Method Detail

getDocument

public BasicDocument getDocument()
Fetches the document associated with this LanguageSupport instance.

Returns:
the document

getProperty

public java.lang.Object getProperty(java.lang.String key)
Fetch the language-specific properties. Subclasses should override this if they have language-specific properties.

Parameters:
key - a non-null property
Returns:
the property (if found)

install

public void install(BasicDocument document)
Associates this LanguageSupport instance with a specific document. This is useful for example if there are caches maintained for this document.

Parameters:
document - the document

deinstall

public void deinstall()
Disassociates this instance from a specific document. This is called for example, when a client requests a different language mode for editing a given document. It may also be called when the document is being disposed of to clear up dangling references.


getDocumentRenderer

public DocumentRenderer getDocumentRenderer()
Fetches the DocumentRenderer for rendering the given document. Note that all implementations are required to provide a DocumentRenderer.

Returns:
the DocumentRenderer that will be used for rendering (syntax-highlighting) the given document content

getBraceProvider

public BraceProvider getBraceProvider()
Fetches the BraceProvider for performing brace matching for this document.

Returns:
the BraceProvider, or null if this language does not support brace matching.

getWordLocator

public WordLocator getWordLocator()
Fetches the WordLocator to use for locating word boundaries for word-based navigator. Implementations may return null to default to the natural language word locator based on the JDK's word break iterator.

Returns:
the WordLocator, or null to use the default word locator

getSmartIndentProvider

public SmartIndentProvider getSmartIndentProvider()
Fetches the SmartIndentProvider to use for performing smart indentation.

Returns:
the SmartIndentProvider for this language

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.