本文整理汇总了Java中org.netbeans.spi.quicksearch.SearchProvider类的典型用法代码示例。如果您正苦于以下问题:Java SearchProvider类的具体用法?Java SearchProvider怎么用?Java SearchProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SearchProvider类属于org.netbeans.spi.quicksearch包,在下文中一共展示了SearchProvider类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: evaluate
import org.netbeans.spi.quicksearch.SearchProvider; //导入依赖的package包/类
/**
* 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);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:CommandEvaluator.java
示例2: getProviders
import org.netbeans.spi.quicksearch.SearchProvider; //导入依赖的package包/类
public List<SearchProvider> getProviders () {
if (providers == null) {
Collection<? extends SearchProvider> catProviders =
Lookups.forPath(fo.getPath()).lookupAll(SearchProvider.class);
providers = new ArrayList<SearchProvider>(catProviders);
}
return providers;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ProviderModel.java
示例3: runEvaluation
import org.netbeans.spi.quicksearch.SearchProvider; //导入依赖的package包/类
private static Task runEvaluation (final SearchProvider provider, final SearchRequest request,
final SearchResponse response, final ProviderModel.Category cat) {
return RP.post(new Runnable() {
@Override
public void run() {
provider.evaluate(request, response);
}
});
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CommandEvaluator.java
示例4: testGetProviders
import org.netbeans.spi.quicksearch.SearchProvider; //导入依赖的package包/类
/** Tests ProviderModel functionality */
public void testGetProviders () throws Exception {
UnitTestUtils.prepareTest(new String [] { "/org/netbeans/modules/quicksearch/resources/testGetProviders.xml" });
ProviderModel model = ProviderModel.getInstance();
System.out.println("Asking for test providers...");
List<ProviderModel.Category> categories = model.getCategories();
assertEquals(3, categories.size());
System.out.println("Testing empty providers category...");
ProviderModel.Category cat = categories.get(0);
assertTrue("empty".equals(cat.getName()));
assertTrue(cat.getName().equals(cat.getDisplayName()));
assertTrue(cat.getCommandPrefix() == null);
System.out.println("Testing category with provider which doesn't define category description...");
cat = categories.get(1);
assertTrue("test1".equals(cat.getName()));
assertTrue(cat.getName().equals(cat.getDisplayName()));
assertTrue(cat.getCommandPrefix() == null);
List<SearchProvider> providers = cat.getProviders();
assertEquals(1, providers.size());
SearchProvider sp = providers.iterator().next();
assertTrue(sp instanceof Test1Provider);
System.out.println("Testing category with provider with full category description...");
cat = categories.get(2);
assertTrue("test2".equals(cat.getName()));
// localized FO name don't work in test, don't know why
//assertTrue(DISPLAY_NAME.equals(cat.getDisplayName()));
assertTrue(COMMAND_PREFIX.equals(cat.getCommandPrefix()));
providers = cat.getProviders();
assertEquals(1, providers.size());
sp = providers.iterator().next();
assertTrue(sp instanceof Test2Provider);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:48,代码来源:ProviderModelTest.java
注:本文中的org.netbeans.spi.quicksearch.SearchProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论