当前位置: 首页>>代码示例>>Java>>正文


Java SearchResponse.addResult方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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


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