Eclipse - Export/Save Search Results
Solution 1
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.
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:
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..
Solution 2
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
Solution 3
I'm using Eclipse Search CSV Export.
Related videos on Youtube
urig
Updated on July 09, 2022Comments
-
urig almost 2 years
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?
I've tried using copy & paste but the resulting text format is far from readable.
-
Antonio over 8 yearsI believe the most recent answer (about the CDT plugin, which works) should be the accepted one.
-
-
eldn about 13 yearsThis may help you as well: wiki.eclipse.org/FAQ_How_do_I_write_a_Search_dialog%3F
-
urig almost 13 yearsSadly, the results in 'Show as List' lack many details, like line number and full path to file.
-
Keith Tyler about 3 yearsThis isn't true... list view only gives the matching files, and count of matches, (like grep -c) but, doesn't give the actual matched lines.
-
Navigatron over 2 yearsThis worked perfectly. Eclipse Version: 2021-06 (4.20.0)