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.
|
@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.