Skip navigation links
org.netbeans.modules.editor.indent/2 1.67

Editor Indentation
Under Development

See: Description

Editor Indentation 
Package Description
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.

What is New (see all changes)?

Use Cases

API Usecases

Fix indentation of a single or multiple lines of a document.

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 of a selected area of a document.

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();
}

Exported Interfaces

This table lists all of the module exported APIs with defined stability classifications. It is generated based on answers to questions about the architecture of the module. Read them all...
Group of java interfaces
Interface NameIn/OutStabilitySpecified in What Document?
EditorIndentationAPIExportedUnder Development

Implementation Details

Where are the sources for the module?

The sources for the module are in the Apache Git repositories or in the GitHub repositories.

What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?

Nothing.

Read more about the implementation in the answers to architecture questions.

Skip navigation links
org.netbeans.modules.editor.indent/2 1.67