blob: e3fb2f27db0f27e7ed7b29dc690f0d1dfe5cda64 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181) on Fri Sep 14 11:37:06 BST 2018 -->
<title>Overview (Editor Hints)</title>
<meta name="date" content="2018-09-14">
<link rel="stylesheet" type="text/css" href="javadoc.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Overview (Editor Hints)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li class="navBarCell1Rev">Overview</li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">org.netbeans.spi.editor.hints/0 1.44.1 7</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title">Editor Hints<br/><span style='font-style:normal; font-size:medium; font-weight:normal; background-color:#ffffff;'><a href='http://wiki.netbeans.org/API_Stability#Stable' target='_blank'>Stable</a></span></h1>
</div>
<div class="header">
<p>See: <a href="#overview.description">Description</a></p>
</div>
<div class="contentContainer">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Editor Hints table, listing packages, and an explanation">
<caption><span>Editor Hints</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="org/netbeans/spi/editor/hints/package-summary.html">org.netbeans.spi.editor.hints</a></td>
<td class="colLast">
<div class="block">.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="org/netbeans/spi/editor/hints/settings/package-summary.html">org.netbeans.spi.editor.hints.settings</a></td>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<div class="contentContainer"><a name="overview.description">
<!-- -->
</a>
<div class="block"><p>
<p>
<a href="org/netbeans/spi/editor/hints/package-summary.html">EditorHintsSPI</a>
allows to show errors in the editor, with possible fixes.
</p>
</p>
<h3>What is New (see <a href="apichanges.html">all changes</a>)?</h3>
<ul>
<!--Search for dates that are later or equal to 1997-09-01 in
.-->
<!--Checking date 2017-7-24 with count of newer 0--><!--year ok-->
<li>Jul 24 '17 <a href="apichanges.html#fixable-annotation-default-action">Provide a way to have fixable annotation with default action</a>
<p>
For custom type of annotations will dynamically register this annotation type as fixable, so Fix action (click on the icon) will work for it
</p>
</li>
<!--Checking date 2017-7-17 with count of newer 1--><!--year ok-->
<li>Jul 17 '17 <a href="apichanges.html#multiple-annotation-type">Support multiple ranges for ErrorDescriptor</a>
<p>
Added support for multiple ranges for error/warning. New field added to ErrorDescription as well as corresponding getter method and new constructor
in order to be able to provide multiple ranges support for highlight particular hint. Added new factory method to
ErrorDescriptionFactory which uses new ErrorDescription constructor.
</p>
</li>
<!--Checking date 2015-8-26 with count of newer 2--><!--year ok-->
<li>Aug 26 '15 <a href="apichanges.html#custom-annotation-type">Added customType field and constructor to ErrorDescription</a>
<p>
Added customType field to ErrorDescription as well as corresponding getter method and new constructor
in order to be able to provide custom annotation type for particular hint. Added new factory method to
ErrorDescriptionFactory which uses new ErrorDescription constructor.
</p>
</li>
<!--Checking date 2013-4-24 with count of newer 3--><!--year ok-->
<li>Apr 24 '13 <a href="apichanges.html#per-project-hints">Added a new overload for ErrorDescriptionFactory.createErrorDescription taking PositionBounds</a>
<p>
XXX
</p>
</li>
<!--Checking date 2012-5-17 with count of newer 4--><!--year ok-->
<li>May 17 '12 <a href="apichanges.html#error-description-from-position-bounds">Added a new overload for ErrorDescriptionFactory.createErrorDescription taking PositionBounds</a>
<p>
Added several a new variant of ErrorDescriptionFactory.createErrorDescription
taking PositionBounds to specify the span of the error/warning.
</p>
</li>
<!--Checking date 2012-3-19 with count of newer 5--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2010-2-24 with count of newer 6--><!--Skipped as the amount of changes is too big-->
<!--Checking date 2009-7-20 with count of newer 7--><!--Skipped as the amount of changes is too big-->
</ul>
<h3>Use Cases</h3>
<answer id="arch-usecases">
<p>
<h5>redunderline</h5>
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:
<pre xml:space="preserve">
Document doc = ...;
ArrayList&lt;ErrorDescription&gt; errors = new ArrayList&lt;ErrorDescription&gt;();
for (&lt;all errors from the parser that have parsed the doc&gt;) {
errors.add(
<b>ErrorDescriptionFactory.createErrorDescription</b>(
Severity.ERROR,
d.getMessage(Locale.getDefault()),
doc,
doc.createPosition(start),
doc.createPosition(end)
)
);
}
<b>HintsController.setErrors</b>(doc, "myerrors", errors);
</pre>
<h5>warningwithfix</h5>
Adding a warning with fixes:
<pre xml:space="preserve">
static final class FixImpl implements Fix {
...
}
...
Document doc = ...;
List&lt;Fix&gt; <b>fixes</b> = Arrays.&lt;Fix&gt;asList(new FixImpl(...));
ArrayList&lt;ErrorDescription&gt; warnings = new ArrayList&lt;ErrorDescription&gt;();
for (&lt;all places where the warning should be displayed&gt;) {
warnings.add(
ErrorDescriptionFactory.createErrorDescription(
Severity.WARNING,
displayName,
<b>fixes</b>,
doc,
doc.createPosition(start),
doc.createPosition(end)
)
);
}
HintsController.setErrors(doc, "mywarnings", warnings);
</pre>
</p>
</answer>
<h3>Exported Interfaces</h3>
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. <a href="architecture-summary.html">Read them all</a>...
<a name="group-java">
<h5>Group of java interfaces</h5>
</a>
<table cellpadding="1" cellspacing="0" border="0" class="tablebg" width="100%">
<tr>
<td>
<table border="0" cellpadding="3" cellspacing="1" width="100%">
<tr class="tablersh">
<td align="CENTER" width="25%"><span class="titlectable">Interface Name</span></td><td align="CENTER" width="10%"><span class="titlectable">In/Out</span></td><td align="CENTER" width="10%"><span class="titlectable">Stability</span></td><td align="CENTER"><span class="titlectable">Specified in What Document?</span></td>
</tr>
<tr class="tabler">
<td>EditorHintsSPI</td><td>Exported</td><td><a href="http://wiki.netbeans.org/API_Stability#Stable">Stable</a></td><td><a name="java-EditorHintsSPI"><a href="org/netbeans/spi/editor/hints/package-summary.html">
.../spi/editor/hints/package-summary.html</a>
<p></p>
<p></p>
allows to show errors in the editor, with possible fixes.
<p></p>
</a></td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<h3>Implementation Details</h3>
<h5>Where are the sources for the module?</h5>
<p>
<p>
The sources for the module are in the
<a href="http://hg.netbeans.org/" shape="rect">NetBeans Mercurial repositories</a>.
</p>
</p>
<h5>What do other modules need to do to declare a dependency on this one, in addition to or instead of a plain module dependency?</h5>
<p>
Normal module dependencies are used for this module.
</p>
<p>
Read more about the implementation in the <a href="architecture-summary.html">answers to
architecture questions</a>.
</p></div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li class="navBarCell1Rev">Overview</li>
<li>Package</li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-files/index-1.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">org.netbeans.spi.editor.hints/0 1.44.1 7</div>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><span class="footnote">Built on September 14 2018.&nbsp;&nbsp;|&nbsp;&nbsp; Copyright &#169; 2017-2018 Apache Software Foundation. All Rights Reserved.</span></small></p>
</body>
</html>