Extension SDK 10.1.2

oracle.javatools.editor.language
Class AbstractLanguageSupport

java.lang.Object
  extended byoracle.javatools.editor.language.AbstractLanguageSupport
All Implemented Interfaces:
LanguageSupport

public abstract class AbstractLanguageSupport
extends java.lang.Object
implements LanguageSupport

An AbstractLanguageSupport is the base class for all LanguageSupports provided with this editor component. It takes care of implementing common functionality.


Field Summary
 
Fields inherited from interface oracle.javatools.editor.language.LanguageSupport
PROPERTY_LINE_COMMENT_START
 
Constructor Summary
AbstractLanguageSupport()
           
 
Method Summary
protected  BraceProvider createBraceProvider()
          Creates a new BraceProvider for performing brace matching for this document.
protected abstract  DocumentRenderer createDocumentRenderer()
          Creates the DocumentRenderer for rendering the given document.
protected  SmartIndentProvider createSmartIndentProvider()
          Creates a new SmartIndentProvider for performing smart indentation for this language.
protected  WordLocator createWordLocator()
          Creates a new WordLocator for defining word boundaries that make sense for a given language.
 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)
          Gets language-specific properties.
protected  java.lang.Object getPropertyImpl(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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLanguageSupport

public AbstractLanguageSupport()
Method Detail

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.

Specified by:
install in interface LanguageSupport
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.

Specified by:
deinstall in interface LanguageSupport

getDocument

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

Specified by:
getDocument in interface LanguageSupport
Returns:
the document

getProperty

public final java.lang.Object getProperty(java.lang.String key)
Gets language-specific properties. This allows languages to have a chance to define their own custom properties.

Specified by:
getProperty in interface LanguageSupport
Parameters:
key - a non-null property
Returns:
the property (if found)

getPropertyImpl

protected java.lang.Object getPropertyImpl(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)

getDocumentRenderer

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

Specified by:
getDocumentRenderer in interface LanguageSupport
Returns:
the DocumentRenderer that will be used for rendering (syntax-highlighting) the given document content

getBraceProvider

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

Specified by:
getBraceProvider in interface LanguageSupport
Returns:
a new BraceProvider for brace matching, or null if brace matching is not supported for this language.

getWordLocator

public WordLocator getWordLocator()
Fetches the WordLocator to use for locating word boundaries for word-based navigator. Implementations may override this to use their own custom word locator instead of the default one based on the natural language word locator based on the JDK's word break iterator.

Specified by:
getWordLocator in interface LanguageSupport
Returns:
the WordLocator

getSmartIndentProvider

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

Specified by:
getSmartIndentProvider in interface LanguageSupport
Returns:
the SmartIndentProvider for this language

createDocumentRenderer

protected abstract DocumentRenderer createDocumentRenderer()
Creates 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

createBraceProvider

protected BraceProvider createBraceProvider()
Creates a new BraceProvider for performing brace matching for this document.

Returns:
a new BraceProvider for brace matching, or null if brace matching is not supported for this language.

createWordLocator

protected WordLocator createWordLocator()
Creates a new WordLocator for defining word boundaries that make sense for a given language. The default one uses the JDK's break iterator for natural word boundaries.

Returns:
a new WordLocator for locating word boundaries

createSmartIndentProvider

protected SmartIndentProvider createSmartIndentProvider()
Creates a new SmartIndentProvider for performing smart indentation for this language.

Returns:
a new SmartIndentProvider, or null if this language does not support smart indentation

Extension SDK

 

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