1 11 12 package org.eclipse.search2.internal.ui.text2; 13 14 import org.eclipse.core.resources.IResource; 15 16 import org.eclipse.ui.IWorkingSet; 17 18 import org.eclipse.search.ui.ISearchQuery; 19 import org.eclipse.search.ui.text.FileTextSearchScope; 20 import org.eclipse.search.ui.text.TextSearchQueryProvider; 21 22 import org.eclipse.search.internal.ui.text.FileSearchQuery; 23 24 public class DefaultTextSearchQueryProvider extends TextSearchQueryProvider { 25 26 29 public ISearchQuery createQuery(TextSearchInput input) { 30 FileTextSearchScope scope= input.getScope(); 31 String text= input.getSearchText(); 32 boolean regEx= input.isRegExSearch(); 33 boolean caseSensitive= input.isCaseSensitiveSearch(); 34 return new FileSearchQuery(text, regEx, caseSensitive, scope); 35 } 36 37 40 public ISearchQuery createQuery(String searchForString) { 41 FileTextSearchScope scope= FileTextSearchScope.newWorkspaceScope(getPreviousFileNamePatterns(), false); 42 return new FileSearchQuery(searchForString, false, true, scope); 43 } 44 45 48 public ISearchQuery createQuery(String selectedText, IResource[] resources) { 49 FileTextSearchScope scope= FileTextSearchScope.newSearchScope(resources, getPreviousFileNamePatterns(), false); 50 return new FileSearchQuery(selectedText, false, true, scope); 51 } 52 53 56 public ISearchQuery createQuery(String selectedText, IWorkingSet[] ws) { 57 FileTextSearchScope scope= FileTextSearchScope.newSearchScope(ws, getPreviousFileNamePatterns(), false); 58 return new FileSearchQuery(selectedText, false, true, scope); 59 } 60 61 private String [] getPreviousFileNamePatterns() { 62 return new String [] { "*" }; } 64 65 } 66 | Popular Tags |