Eclipse - 导出/保存搜索结果

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5339088/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 16:00:55  来源:igfitidea点击:

Eclipse - Export/Save Search Results

eclipsesearch

提问by urig

Eclipse's Search results view is quite handy with its tree-like structure. Is there any way to export these results to a readable text format or save them to a file for later use?

Eclipse 的搜索结果视图以其树状结构非常方便。有什么方法可以将这些结果导出为可读的文本格式或将它们保存到文件中以备后用?

I've tried using copy & paste but the resulting text format is far from readable.

我试过使用复制和粘贴,但生成的文本格式远非可读。

采纳答案by eldn

No I don't think there is a possibility to export the results yet. (Update: Now there's a suitable plugin available). But you should be able to use the eclipse search framework programmatically an export the entries by yourself.

不,我认为还没有导出结果的可能性。(更新:现在有一个合适的插件可用)。但是您应该能够以编程方式使用 eclipse 搜索框架并自己导出条目。

I did not test the following snipped but implemeted a custom search that way once (using the RetrieverAction class). You should be able to listen to search result changes without the action as well:

我没有测试以下代码片段,但以这种方式实现了一次自定义搜索(使用RetrieverAction 类)。您也应该能够在没有操作的情况下收听搜索结果的变化:

TextSearchQueryProvider provider= TextSearchQueryProvider.getPreferred();

// your input (you'll have to implement that one I think...)
TextSearchInput input = new TextSearchQueryProvider.TextSearchInput();

ISearchQuery query= provider.createQuery(input);
ISearchResult result = query.getSearchResult();
result.addListener(new ISearchResultListener() {

    public void searchResultChanged(SearchResultEvent e) {
        // -> export result
    }
});

// run the query
NewSearchUI.runQueryInBackground(query);

Again: I did not test that at all and don't know if there is a better approach as well..

再说一遍:我根本没有测试过,也不知道是否还有更好的方法..

回答by Jammy Lee

You can change the mode from tree to list by click 'upper-right corner triangle' ->'show in list', then just copy all the files in the list , it will be a perfect list of search result

您可以通过单击“右上角三角形”->“在列表中显示”将模式从树状模式更改为列表模式,然后只需将列表中的所有文件复制即可,这将是一个完美的搜索结果列表

回答by Mayoares