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


Java SearchRequest.getText方法代码示例

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


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

示例1: highlightSubstring

import org.netbeans.spi.quicksearch.SearchRequest; //导入方法依赖的package包/类
private String highlightSubstring (String text, SearchRequest sRequest) {
    if (text.startsWith(HTML)) {
        // provider handles highliting itself, okay
        return text;
    }
    // try to find substring
    String searchedText = sRequest.getText();
    int index = text.toLowerCase(Locale.ENGLISH).indexOf(searchedText.toLowerCase(Locale.ENGLISH));
    if (index == -1) {
        return HTML + safeEscape(text);
    }
    // found, bold it
    int endIndex = index + searchedText.length();
    StringBuilder sb = new StringBuilder(HTML);
    if (index > 0) {
        sb.append(safeEscape(text.substring(0, index)));
    }
    sb.append("<b>");
    sb.append(safeEscape(text.substring(index, endIndex)));
    sb.append("</b>");
    if (endIndex < text.length()) {
        sb.append(safeEscape(text.substring(endIndex, text.length())));
    }
    return sb.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ResultsModel.java

示例2: evaluate

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

示例3: evaluate

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


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