public final class SearchResponse extends Object
SearchProvider.evaluate(org.netbeans.spi.quicksearch.SearchRequest, org.netbeans.spi.quicksearch.SearchResponse)
search
operation. SearchProvider implementors are expected to fill SearchResponse
in steps by calling various SearchResponse.addResult(java.lang.Runnable, java.lang.String)
methods.Modifier and Type | Method and Description |
---|---|
boolean |
addResult(Runnable action,
String htmlDisplayName)
Adds new result of quick search operation.
|
boolean |
addResult(Runnable action,
String htmlDisplayName,
String displayHint,
List<? extends KeyStroke> shortcut)
Adds new result of quick search operation.
|
boolean |
isObsolete()
Determines if the response is already obsolete.
|
@CheckReturnValue public boolean addResult(Runnable action, String htmlDisplayName)
action
- Runnable to invoke when this result item is chosen by user.
Providers are expected to signal unsuccessful invocation of Runnable.run
by writing into status line and producing beep. Invocation failures may happen,
as Runnable.run
may be called later, when conditions or context
changed in a way that action can't be performed.htmlDisplayName
- Localized display name of this result item.
May start with <html>
in which case the text may use HTML tags;
then <b>...</b>
tags should be used to emphasize part of the result.
Common provider implementations will use bold marking for found substring, so
resulting string should look like <html>Item containing <b>searched</b> text
, where
searched
is text returned from SearchRequest.getText()
.
Use of other HTML tags is discouraged.
If plain text is passed, the first occurrence of the search string will be highlighted automatically.SearchProvider
implementors should stop computing and leave
SearchProvider.evaluate(...) immediately if false is returned.@CheckReturnValue public boolean addResult(Runnable action, String htmlDisplayName, String displayHint, List<? extends KeyStroke> shortcut)
action
- Runnable to invoke when this result item is chosen by user.
Providers are expected to signal unsuccessful invocation of Runnable.run
by writing into status line and producing beep. Invocation failures may happen,
as Runnable.run
may be called later, when conditions or context
changed in a way that action can't be performed.htmlDisplayName
- see SearchResponse.addResult(Runnable,String)
for descriptiondisplayHint
- Localized display hint of this result item or null if not availableshortcut
- Shortcut of this result item or null if shortcut isn't availableSearchProvider
implementors should stop computing and leave
SearchProvider.evaluate(...) immediately if false is returned.public boolean isObsolete()
SearchResponse.addResult(java.lang.Runnable, java.lang.String)
: if
false, the Provider should terminate the search immediately. Provider can query
this status in case it does not find any results so it does not waste time
searching further.