1 11 package org.eclipse.search2.internal.ui; 12 13 import java.util.ArrayList ; 14 15 import org.eclipse.jface.action.Action; 16 import org.eclipse.jface.window.Window; 17 18 import org.eclipse.search.ui.ISearchQuery; 19 import org.eclipse.search.ui.ISearchResult; 20 import org.eclipse.search.ui.NewSearchUI; 21 22 import org.eclipse.search.internal.ui.SearchPlugin; 23 24 25 26 30 class ShowSearchHistoryDialogAction extends Action { 31 private SearchView fSearchView; 32 33 34 37 public ShowSearchHistoryDialogAction(SearchView searchView) { 38 super(SearchMessages.ShowSearchesAction_label); 39 setToolTipText(SearchMessages.ShowSearchesAction_tooltip); 40 fSearchView= searchView; 41 } 42 43 public void run() { 44 ISearchQuery[] queries= NewSearchUI.getQueries(); 45 46 ArrayList input= new ArrayList (); 47 for (int j= 0; j < queries.length; j++) { 48 ISearchResult search= queries[j].getSearchResult(); 49 input.add(search); 50 } 51 52 SearchHistorySelectionDialog dlg= new SearchHistorySelectionDialog(SearchPlugin.getActiveWorkbenchShell(),input); 53 54 ISearchResult current= fSearchView.getCurrentSearchResult(); 55 if (current != null) { 56 Object [] selected= new Object [1]; 57 selected[0]= current; 58 dlg.setInitialSelections(selected); 59 } 60 if (dlg.open() == Window.OK) { 61 Object [] result= dlg.getResult(); 62 if (result != null && result.length == 1) { 63 ISearchResult searchResult= (ISearchResult) result[0]; 64 InternalSearchUI.getInstance().showSearchResult(fSearchView, searchResult, dlg.isOpenInNewView()); 65 } 66 } 67 68 } 69 } 70 | Popular Tags |