• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SearchResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.netbeans.spi.quicksearch.SearchResponse的典型用法代码示例。如果您正苦于以下问题:Java SearchResponse类的具体用法?Java SearchResponse怎么用?Java SearchResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SearchResponse类属于org.netbeans.spi.quicksearch包,在下文中一共展示了SearchResponse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的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: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Override
public void evaluate(SearchRequest request, SearchResponse response) {
    boolean atLeastOne = false;
    boolean limitReached = false;
    for (ItemResult itemR : RecentSearches.getDefault().getSearches()) {
        if (itemR.getDisplayName().toLowerCase().indexOf(request.getText().toLowerCase()) != -1) {
            if (!response.addResult(itemR.getAction(), itemR.getDisplayName(),
                    itemR.getDisplayHint(), itemR.getShortcut())) {
                limitReached = true;
                break;
            } else {
                atLeastOne = true;
            }
        }
    }
    if (atLeastOne && !limitReached && request.getText().isEmpty()) {
        addClearAction(response);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:RecentProvider.java


示例3: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Override
   public void evaluate(SearchRequest request, SearchResponse response) {
readKeywordsFromNewAnnotation();
       for (Lookup.Item<OptionsCategory> entry : getODCategories()) {
           for (Map.Entry<String, Set<String>> kw : getKeywords(entry).entrySet()) {
               for (String keywords : kw.getValue()) {
	    for (String keyword : Arrays.asList(keywords.split(","))) {
		if (keyword.toLowerCase().indexOf(request.getText().toLowerCase()) > -1) {
		    String path = entry.getId().substring(entry.getId().indexOf("/") + 1);  // NOI18N
		    if (kw.getKey().contains("/")) {
			path = path + kw.getKey().substring(kw.getKey().indexOf("/")); //NOI18N
		    }
		    if (!response.addResult(new OpenOption(path), keyword)) {
			return;
		    }
		}
	    }
               }
           }
       }
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:QuickSearchProvider.java


示例4: work

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Messages({"# {0} - server label", "# {1} - job name", "search_response=Hudson job {1} on {0}"})
private void work(String text, SearchResponse response) {
    for (final HudsonInstance instance : HudsonManager.getAllInstances()) {
        for (HudsonJob job : instance.getJobs()) {
            final String name = job.getName();
            // XXX could also search for text in instance name, and/or Maven modules
            if (name.toLowerCase(Locale.ENGLISH).contains(text.toLowerCase(Locale.ENGLISH))) {
                if (!response.addResult(new Runnable() {
                    @Override public void run() {
                        UI.selectNode(instance.getUrl(), name);
                    }
                }, Bundle.search_response(instance.getName(), name))) {
                    return;
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SearchProviderImpl.java


示例5: findMatches

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
private List<InputNode> findMatches(String name, String value, InputGraph inputGraph, SearchResponse response) {
    try {
        RegexpPropertyMatcher matcher = new RegexpPropertyMatcher(name, value, Pattern.CASE_INSENSITIVE);
        Properties.PropertySelector<InputNode> selector = new Properties.PropertySelector<>(inputGraph.getNodes());
        List<InputNode> matches = selector.selectMultiple(matcher);
        return matches.size() == 0 ? null : matches;
    } catch (Exception e) {
        final String msg = e.getMessage();
        response.addResult(new Runnable() {
            @Override
            public void run() {
                Message desc = new NotifyDescriptor.Message("An exception occurred during the search, "
                        + "perhaps due to a malformed query string:\n" + msg,
                        NotifyDescriptor.WARNING_MESSAGE);
                DialogDisplayer.getDefault().notify(desc);
            }
        },
                "(Error during search)"
        );
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:NodeQuickSearch.java


示例6: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Override
public void evaluate(SearchRequest request, SearchResponse response) {
    final String searchText = request.getText().toLowerCase();

    for (final Project project : OpenProjects.getDefault().getOpenProjects()) {
        final ProjectInformation info = ProjectUtils.getInformation(project);
        if (info == null || info.getDisplayName() == null) {
            continue;
        }
        final String projectName = info.getDisplayName();
        final String projectNameLower = projectName.toLowerCase();

        if (projectNameLower.contains(searchText)) {
            final boolean result = response.addResult(new Runnable() {
                @Override
                public void run() {
                    //see http://forums.netbeans.org/post-140855.html#140855
                    ProjectUtilities.selectAndExpandProject(project);
                    ProjectUtilities.makeProjectTabVisible();
                }
            }, projectName);
            if (!result) {
                break;
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:SearchForProjectsQuickSearch.java


示例7: doEvaluation

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
private boolean doEvaluation(String name, SearchRequest request,
        ActionInfo actInfo, SearchResponse response, List<ActionInfo> possibleResults, Map<Object, String> duplicateCheck) {
    int index = name.toLowerCase().indexOf(request.getText().toLowerCase());
    if (index == 0) {
        return addAction(actInfo, response, duplicateCheck);
    } else if (index != -1) {
        // typed text is contained in action name, but not as prefix,
        // store such actions if there are not enough "prefix" actions
        possibleResults.add(actInfo);
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ActionsSearchProvider.java


示例8: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
public void evaluate(SearchRequest request, SearchResponse response) {
    synchronized( this ) {
        if( null == query ) {
            query = JavaHelpQuery.getDefault();
        }
    }
    List<SearchTOCItem> res = query.search( request.getText() );
    for( SearchTOCItem item : res ) {
        if( !response.addResult( createAction( item.getURL() ), item.getName() ) )
            return;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:JavaHelpQuickSearchProviderImpl.java


示例9: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
public void evaluate(SearchRequest request, SearchResponse response) {
    if( null == query ) {
        query = Query.getDefault();
    }
    Result res = query.search( request.getText() );
    do {
        for( Item item : res.getItems() ) {
            if( !response.addResult( createAction( item.getUrl() ), item.getTitle() ) )
                return;
        }
        res = query.searchMore( request.getText() );
    } while( !res.isSearchFinished() );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:WebQuickSearchProviderImpl.java


示例10: runEvaluation

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的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


示例11: addClearAction

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@NbBundle.Messages("RecentSearches.clear=(Clear recent searches)")
private void addClearAction(SearchResponse response) {
    boolean add = response.addResult(new Runnable() {
        @Override
        public void run() {
            RecentSearches.getDefault().clear();
        }
    }, "<html><i>" + Bundle.RecentSearches_clear() + "</i></html>");//NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:RecentProvider.java


示例12: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
public void evaluate(SearchRequest request, SearchResponse response) {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException ex) {
        System.err.println("SlowProvider interrupted...");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SlowProviderTest.java


示例13: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Override
public void evaluate(SearchRequest request, SearchResponse response) {
    String text = removeNonJavaChars(request.getText());
    if(text.length() == 0) {
        return;
    }

    final GoToTypeWorker newWorker = new GoToTypeWorker(text);
    final GoToTypeWorker toCancel = workerRef.getAndSet(newWorker);
    if (toCancel != null) {
        toCancel.cancel();
    }
    try {
        newWorker.run();
    } finally {
        workerRef.compareAndSet(newWorker, null);
    }
    
    for (TypeDescriptor td : newWorker.getTypes()) {
        String displayHint = td.getFileDisplayPath();
        String htmlDisplayName = td.getSimpleName() + td.getContextName();
        final String projectName = td.getProjectName();
        if (projectName != null && !projectName.isEmpty()) {
            htmlDisplayName = String.format(
                "%s [%s]",  //NOI18N
                htmlDisplayName,
                projectName);
        }
        if (!response.addResult(new GoToTypeCommand(td),
                                htmlDisplayName,
                                displayHint,
                                null)) {
            break;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:37,代码来源:JavaTypeSearchProvider.java


示例14: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
public void evaluate(SearchRequest request, SearchResponse response) {
    String text = removeNonJavaChars(request.getText());
    if(text.length() == 0) {
        return;
    }
    GoToSymbolWorker local;
    synchronized(this) {
        if (worker!=null) {
            worker.cancel();
        }
        worker = new GoToSymbolWorker(text);
        local = worker;
    }
    local.run();
    
    for (SymbolDescriptor td : local.getTypes()) {
        String displayHint = td.getFileDisplayPath();
        String htmlDisplayName = escapeLtGt(td.getSymbolName()) + " " + NbBundle.getMessage(GoToSymbolAction.class, "MSG_DeclaredIn",escapeLtGt(td.getOwnerName()));
        final String projectName = td.getProjectName();
        if (projectName != null && !projectName.isEmpty()) {
            htmlDisplayName = String.format(
                "%s [%s]",  //NOI18N
                htmlDisplayName,
                projectName);
        }
        if (!response.addResult(new GoToSymbolCommand(td),
                                htmlDisplayName,
                                displayHint,
                                null)) {
            break;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:GoToSymbolProvider.java


示例15: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Override public void evaluate(SearchRequest request, SearchResponse response) {
    String text = request.getText();
    if (text == null) {
        return;
    }
    if (!Utilities.isHudsonSupportActive()) {
        return;
    }
    work(text, response);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SearchProviderImpl.java


示例16: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
/**
 * Shows search results on search bar.
 */
@Override
public void evaluate(SearchRequest request, SearchResponse response) {
    List<FileObject> foundFiles;
    Project project = ProjectUtils.getCurrentProject();
    if (project != null) {
        FileObject projectDirectory = project.getProjectDirectory();
        String fileName = request.getText();
        foundFiles = searchFile(projectDirectory, fileName);
        for (FileObject foundFile : foundFiles) {
            String foundFileName = foundFile.getNameExt();
            response.addResult(new SearchResult(foundFile), foundFileName);
        }
    }
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:18,代码来源:SalesforceSearchProvider.java


示例17: examineModel

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
private boolean examineModel(SearchRequest request, SearchResponse response, TypeModel model) {
    if (!model.getName().toLowerCase().contains(request.getText().toLowerCase())) {
        return true;
    }

    String displayName = QuickSearchFormatter.INSTANCE.format(model);
    if (displayName == null || displayName.isEmpty()) {
        return true;
    }

    return response.addResult(new Handler(model), displayName);
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:13,代码来源:GoToTypeSearchProvider.java


示例18: examineModel

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
private boolean examineModel(SearchRequest request, SearchResponse response, CodeElementModel model) {
    if (!model.getName().toLowerCase().contains(request.getText().toLowerCase())) {
        return true;
    }

    String displayName = QuickSearchFormatter.INSTANCE.format(model);
    if (displayName == null || displayName.isEmpty()) {
        return true;
    }

    return response.addResult(new Handler(model), displayName);
}
 
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:13,代码来源:GoToSymbolSearchProvider.java


示例19: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
public void evaluate(SearchRequest request, SearchResponse response) {
    // no operation
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ProviderModelTest.java


示例20: evaluate

import org.netbeans.spi.quicksearch.SearchResponse; //导入依赖的package包/类
@Override
public void evaluate(SearchRequest request, SearchResponse response) {
    super.evaluate(request, response); //To change body of generated methods, choose Tools | Templates.
}
 
开发者ID:Chris2011,项目名称:NbQuickSearchExtender,代码行数:5,代码来源:StackoverflowSearchProvider.java



注:本文中的org.netbeans.spi.quicksearch.SearchResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OkHttp3IdlingResource类代码示例发布时间:2022-05-22
下一篇:
Java DefaultObserver类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap