|
org.netbeans.modules.editor.indent/2 1.9.0 | |||||||||
| PREV NEXT | FRAMES NO FRAMES | |||||||||
See:
Description
| Editor Indentation | |
|---|---|
| org.netbeans.modules.editor.indent.api | |
| org.netbeans.modules.editor.indent.spi | |
Editor Indentation module defines
EditorIndentationAPI
providing indentation and reformatting services to the clients.
It also contains SPI allowing the modules to register language-specific
indenters and formatters into
MimeLookup
through XML layers.
The new CodeStylePreferences class was added in order to
unify access to editor formatting/indentation preferences (ie. code style).
The API/SPI classes were moved from the official org.netbeans.api
and org.netbeans.spi packages and the stability level
of the API was set to devel to indicate that the module
and its API is still under development. The major version of the
module was set to 2 to mark the incompatible change.
There was not enough time in the Netbeans 6.0 release timeframe for us to fully stabilize the APIs offered by this module. Therefore we decided to release the development version of the APIs and do a full API review in the next release cycle.
Added Context.lineIndent(), Context.lineStartOffset(),
Context.caretOffset(), Context.setCaretOffset()
and Context.indentRegions() methods (including Context.Region class).
Fixed Context.modifyIndent() signature and implementation.
Added Context.mimePath() method.
The module was created.
Altghough there are formatting actions already there may be clients wishing to explicitly fix indentation of e.g. a newly inserted code into a Swing document.
The same code is used after inserting a newline into a document.
The Indent is an entry point for performing reindentation. The following code should be used by clients:
Indent indent = Indent.get(doc);
indent.lock();
try {
doc.atomicLock();
try {
indent.reindent(startOffset, endOffset);
} finally {
doc.atomicUnlock();
}
} finally {
indent.unlock();
}
Code beautification should not only fix line indentation but it may also perform extra changes to code according to formatting rules. For example add newlines or additional whitespace or add/remove extra braces etc.
The Reformat class should be used:
Reformat reformat = Reformat.get(doc);
reformat.lock();
try {
doc.atomicLock();
try {
reformat.reformat(startOffset, endOffset);
} finally {
doc.atomicUnlock();
}
} finally {
reformat.unlock();
}
|
The sources for the module are in the NetBeans Mercurial repositories.
Nothing.
Read more about the implementation in the answers to architecture questions.
|
org.netbeans.modules.editor.indent/2 1.9.0 | |||||||||
| PREV NEXT | FRAMES NO FRAMES | |||||||||