public interface SearchProvider
<folder name="QuickSearch">
<folder name="MyCategoryID">
<!--Attribute for localization - provide localized display name of category!-->
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.yourmodule.YourBundle"/>
<!--Attribute for command prefix - used to narrow search to this category only!-->
<attr name="command" stringvalue="p"/>
<!--Attribute for category ordering!-->
<attr name="position" intvalue="200"/>
<!--Note that multiple providers can contribute to one category!-->
<file name="org-netbeans-module2-package2-MySearchProviderImpll.instance"/>
<file name="org-netbeans-module2-package3-MySearchProviderImpl2.instance"/>
</folder>
</folder>
| Modifier and Type | Method and Description |
|---|---|
void |
evaluate(SearchRequest request,
SearchResponse response)
Method is called by infrastructure when search operation was requested.
|
void evaluate(SearchRequest request, SearchResponse response)
for (SearchedItem item : getAllItemsToSearchIn()) {
if (isConditionSatisfied(item, request)) {
if (!response.addResult(item.getRunnable(), item.getDisplayName(),
item.getShortcut(), item.getDisplayHint())) {
break;
}
}
}
It may happen that the Provider searches for some considerable time, or searches
a considerable number of items without any results. It may check use
SearchResponse.isObsolete() to determine if the search was cancelled
or obsoleted without adding any items.
Threading: This method can be called outside EQ thread by infrastructure.
request - Search request object that contains information what to
search for.response - Search response object that stores search results. Note
that it's important to react to return value of SearchResponse.addResult(...)
method and stop computation if false value is returned.