use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class DefaultTextSearchQueryProvider method createQuery.
@Override
public ISearchQuery createQuery(TextSearchInput input) {
FileTextSearchScope scope = input.getScope();
String text = input.getSearchText();
boolean regEx = input.isRegExSearch();
boolean caseSensitive = input.isCaseSensitiveSearch();
boolean wholeWord = input.isWholeWordSearch();
boolean searchInBinaries = input.searchInBinaries();
Assert.isLegal(!(wholeWord && regEx));
return new FileSearchQuery(text, regEx, caseSensitive, wholeWord, searchInBinaries, scope);
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class AnnotationManagerTest method setUp.
@Before
public void setUp() {
SearchTestPlugin.ensureWelcomePageClosed();
EditorAnnotationManager.debugSetHighlighterType(EditorAnnotationManager.HIGHLIGHTER_ANNOTATION);
String[] fileNamePattern = { "*.java" };
FileTextSearchScope scope = FileTextSearchScope.newWorkspaceScope(fileNamePattern, false);
// $NON-NLS-1$//$NON-NLS-2$
fQuery1 = new FileSearchQuery("Test", false, true, scope);
// $NON-NLS-1$//$NON-NLS-2$
fQuery2 = new FileSearchQuery("Test", false, true, scope);
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class FileSearchTests method testSimpleFiles.
private void testSimpleFiles(TestResultCollector collector) throws Exception {
StringBuilder buf = new StringBuilder();
buf.append("File1\n");
buf.append("hello\n");
buf.append("more hello\n");
buf.append("world\n");
IFolder folder = ResourceHelper.createFolder(fProject.getFolder("folder1"));
IFile file1 = ResourceHelper.createFile(folder, "file1", buf.toString());
IFile file2 = ResourceHelper.createFile(folder, "file2", buf.toString());
Pattern searchPattern = PatternConstructor.createPattern("hello", false, true);
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { fProject }, (String[]) null, false);
TextSearchEngine.create().search(scope, collector, searchPattern, null);
TestResult[] results = collector.getResults();
assertEquals("Number of total results", 4, results.length);
assertMatches(results, 2, file1, buf.toString(), "hello");
assertMatches(results, 2, file2, buf.toString(), "hello");
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class FileSearchTests method testWildCards2.
private void testWildCards2(TestResultCollector collector) throws Exception {
StringBuilder buf = new StringBuilder();
buf.append("File1\n");
buf.append("no more\n");
buf.append("mornings\n");
buf.append("more hello\n");
buf.append("world\n");
IFolder folder = ResourceHelper.createFolder(fProject.getFolder("folder1"));
ResourceHelper.createFile(folder, "file1", buf.toString());
ResourceHelper.createFile(folder, "file2", buf.toString());
Pattern searchPattern = PatternConstructor.createPattern("mo?e", false, false);
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { fProject }, (String[]) null, false);
TextSearchEngine.create().search(scope, collector, searchPattern, null);
TestResult[] results = collector.getResults();
assertEquals("Number of total results", 4, results.length);
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class FileSearchTests method performSearch.
private FileSearchResult performSearch(String[] fileNamePatterns, String pattern) {
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { fProject }, fileNamePatterns, false);
FileSearchQuery query = new FileSearchQuery(pattern, true, true, scope);
query.run(null);
return (FileSearchResult) query.getSearchResult();
}
Aggregations