Eclipse - Export/Save Search Results

20,439

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.

Share:
20,439

Related videos on Youtube

urig
Author by

urig

Updated on July 09, 2022

Comments

  • urig
    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
      Antonio over 8 years
      I believe the most recent answer (about the CDT plugin, which works) should be the accepted one.
  • eldn
    eldn about 13 years
  • urig
    urig almost 13 years
    Sadly, the results in 'Show as List' lack many details, like line number and full path to file.
  • Keith Tyler
    Keith Tyler about 3 years
    This 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
    Navigatron over 2 years
    This worked perfectly. Eclipse Version: 2021-06 (4.20.0)