Skip navigation links
org.netbeans.spi.editor.hints/0 1.47.0 7

Editor Hints
Stable

See: Description

Editor Hints 
Package Description
org.netbeans.spi.editor.hints
.
org.netbeans.spi.editor.hints.settings  

EditorHintsSPI allows to show errors in the editor, with possible fixes.

What is New (see all changes)?

Use Cases

redunderline
Assume that you have a module using e.g. Parsing API to parse the source files and wants to mark the errors in the editor to be shown as red underlined in the editor. Here is the pseudo code that achieves this:
Document doc = ...;
ArrayList<ErrorDescription> errors = new ArrayList<ErrorDescription>();
for (<all errors from the parser that have parsed the doc>) {
    errors.add(
        ErrorDescriptionFactory.createErrorDescription(
            Severity.ERROR,
            d.getMessage(Locale.getDefault()),
            doc,
            doc.createPosition(start),
            doc.createPosition(end)
        )
    );
}
HintsController.setErrors(doc, "myerrors", errors);
warningwithfix
Adding a warning with fixes:
static final class FixImpl implements Fix {
...
}
...
Document doc = ...;
List<Fix> fixes = Arrays.<Fix>asList(new FixImpl(...));
ArrayList<ErrorDescription> warnings = new ArrayList<ErrorDescription>();
for (<all places where the warning should be displayed>) {
    warnings.add(
        ErrorDescriptionFactory.createErrorDescription(
            Severity.WARNING,
            displayName,
            fixes,
            doc,
            doc.createPosition(start),
            doc.createPosition(end)
        )
    );
}
HintsController.setErrors(doc, "mywarnings", warnings);

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?
EditorHintsSPIExportedStable .../spi/editor/hints/package-summary.html

allows to show errors in the editor, with possible fixes.

Implementation Details

Where are the sources for the module?

The sources for the module are in the NetBeans Mercurial 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?

Normal module dependencies are used for this module.

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

Skip navigation links
org.netbeans.spi.editor.hints/0 1.47.0 7