use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class FileSearchQuery method searchInFile.
/**
* @param result all result are added to this search result
* @param monitor the progress monitor to use
* @param file the file to search in
* @return returns the status of the operation
*/
public IStatus searchInFile(final AbstractTextSearchResult result, final IProgressMonitor monitor, IFile file) {
// $NON-NLS-1$
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { file }, new String[] { "*" }, true);
Pattern searchPattern = getSearchPattern();
TextSearchResultCollector collector = new TextSearchResultCollector(result, isFileNameSearch(), fSearchInBinaries);
return TextSearchEngine.create().search(scope, collector, searchPattern, monitor);
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class FileSearchTests method performSearch.
private TestResult[] performSearch(TestResultCollector collector, String[] fileNamePatterns, Pattern searchPattern) {
collector.reset();
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { fProject }, fileNamePatterns, false);
TextSearchEngine.create().search(scope, collector, searchPattern, null);
return collector.getResults();
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class FileSearchTests method testWildCards3.
private void testWildCards3(TestResultCollector collector) throws Exception {
IProject project = fgJUnitSource.getStandardProject();
IFile openFile1 = (IFile) project.findMember("junit/framework/TestCase.java");
IFile openFile2 = (IFile) project.findMember("junit/extensions/ExceptionTestCase.java");
IFile openFile3 = (IFile) project.findMember("junit/framework/Assert.java");
IFile openFile4 = (IFile) project.findMember("junit/samples/money/MoneyTest.java");
IWorkbenchPage activePage = SearchPlugin.getActivePage();
try {
SearchTestPlugin.openTextEditor(activePage, openFile1);
SearchTestPlugin.openTextEditor(activePage, openFile2);
SearchTestPlugin.openTextEditor(activePage, openFile3);
SearchTestPlugin.openTextEditor(activePage, openFile4);
long start = System.currentTimeMillis();
Pattern searchPattern = PatternConstructor.createPattern("\\w*\\(\\)", false, true);
// search in Junit sources
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { project }, (String[]) null, false);
TextSearchEngine.create().search(scope, collector, searchPattern, null);
TestResult[] results = collector.getResults();
assertEquals("Number of total results", 748, results.length);
long end = System.currentTimeMillis();
System.out.println("time= " + (end - start));
} finally {
activePage.closeAllEditors(false);
}
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class LineAnnotationManagerTest method setUp.
@Before
public void setUp() throws Exception {
EditorAnnotationManager.debugSetHighlighterType(EditorAnnotationManager.HIGHLIGHTER_ANNOTATION);
String[] fileNamePatterns = { "*.java" };
FileTextSearchScope scope = FileTextSearchScope.newWorkspaceScope(fileNamePatterns, false);
fLineQuery = new LineBasedFileSearch(scope, false, true, "Test");
}
use of org.eclipse.search.ui.text.FileTextSearchScope in project eclipse.platform.text by eclipse.
the class ResultUpdaterTest method setUp.
@Before
public void setUp() throws Exception {
// create a own project to make modifications
fProject = ResourceHelper.createJUnitSourceProject(PROJECT_TO_MODIFY);
String[] fileNamePatterns = { "*.java" };
FileTextSearchScope scope = FileTextSearchScope.newSearchScope(new IResource[] { fProject }, fileNamePatterns, false);
fQuery1 = new FileSearchQuery("Test", false, true, scope);
}
Aggregations