|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.editor.language.SmartIndentProvider
The SmartIndentProvider
interface provides the
necessary routines that let language-specific implementations
intelligently determine the proper indentation for any given line
should be.
Note that "smart" indentation takes the place of the regular auto-indentation behavior when defined by an implementation AND enabled by that implementation. It is up to each implementation to define properties and options for whether to use smart indentation for that language. This allows us flexibility in enabling smart indentation independently for various language implementations that provide it.
This interface is defined for two situations in which an auto-indentation or reindentation of a line may occur:
It is up to each implementation to determine whether reindenting or auto-indenting makes sense in these situations. Also, the implementation should also provide properties to give the user more flexibility in when auto-indenting or reindenting occurs.
LanguageModule
,
LanguageSupport
Field Summary | |
protected LanguageSupport |
support
The umbrella LanguageSupport instance. |
Constructor Summary | |
protected |
SmartIndentProvider(LanguageSupport support)
Constructs a new SmartIndentProvider |
Method Summary | |
protected BasicDocument |
getDocument()
Private utility routine to fetch the document. |
abstract int |
getIndentForLine(int line,
int indentSize)
Calculates what the indentation for the specified line should be based on the provided indent size. |
protected TextBuffer |
getTextBuffer()
Private utility routine to fetch the text buffer for the document. |
protected java.lang.String |
getUseSmartIndentPropertyName()
Fetches the name of the (boolean) property stored in the EditorProperties that we use to check whether
smart indent is enabled or not. |
abstract boolean |
isAutoReindentTriggerChar(char charTyped)
Fetches whether the char typed by the user should be considered a trigger character for reindenting the current line. |
boolean |
isSmartIndentEnabled(BasicEditorPane editor)
Fetches whether smart indentation is enabled for this language implementation's smart indent provider. |
boolean |
shouldAutoIndentNewLine()
Fetches whether the new line should be auto-indented when a new line is inserted (typed) by the user. |
boolean |
shouldAutoReindentOldLine()
Fetches whether the old (original) line should be reindented when a new line is inserted (typed) by the user. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected LanguageSupport support
LanguageSupport
instance.
Constructor Detail |
protected SmartIndentProvider(LanguageSupport support)
SmartIndentProvider
support
- the language support this indent provider is used forMethod Detail |
protected final TextBuffer getTextBuffer()
protected final BasicDocument getDocument()
protected final java.lang.String getUseSmartIndentPropertyName()
EditorProperties
that we use to check whether
smart indent is enabled or not.
public final boolean isSmartIndentEnabled(BasicEditorPane editor)
The editor is provided so that if this (whether smart indentation
is on or not) is stored as an editor property, it can be retrieved
from the editor using BasicEditorPane.getProperty()
or BasicEditorPane.getBooleanProperty()
.
editor
- the current editor to use for fetching properties
public boolean shouldAutoReindentOldLine()
reindentLine()
.
public boolean shouldAutoIndentNewLine()
public abstract boolean isAutoReindentTriggerChar(char charTyped)
reindentLine()
.
charTyped
- the character that was just typed
public abstract int getIndentForLine(int line, int indentSize)
line
- the line in the document to calculate the indent forindentSize
- the size of a single indent to use
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.