use of org.netbeans.spi.quicksearch.SearchRequest in project netbeans-rcp-lite by outersky.
the class CommandEvaluator method evaluate.
/**
* Runs evaluation.
*
* @param command text to evauate, to search for
*
* @return task of this evaluation, which waits for all providers to complete
* execution. Use returned instance to recognize if this evaluation still
* runs and when it actually will finish.
*/
public static org.openide.util.Task evaluate(String command, ResultsModel model) {
List<CategoryResult> l = new ArrayList<CategoryResult>();
String[] commands = parseCommand(command);
SearchRequest sRequest = Accessor.DEFAULT.createRequest(commands[1], null);
List<Task> tasks = new ArrayList<Task>();
List<Category> provCats = new ArrayList<Category>();
boolean allResults = getProviderCategories(commands, provCats);
for (ProviderModel.Category curCat : provCats) {
CategoryResult catResult = new CategoryResult(curCat, allResults);
SearchResponse sResponse = Accessor.DEFAULT.createResponse(catResult, sRequest);
for (SearchProvider provider : curCat.getProviders()) {
Task t = runEvaluation(provider, sRequest, sResponse, curCat);
if (t != null) {
tasks.add(t);
}
}
l.add(catResult);
}
model.setContent(l);
return new Wait4AllTask(tasks);
}
Aggregations